---
title: "备份我的源码编译的sh文件"
author: "txlong_onz"
date: "2012-07-16T10:34:44Z"
tags: ["Android", "Ubuntu", "build", "sh"]
categories: ["移动开发"]
slug: "sh"
draft: false
lastmod: "2012-07-16T10:35:20Z"
id: 1594884
url: "https://txlong-onz.iteye.com/blog/1594884"
---

编译命令写一次就可以了。以后直接使用。

01-extra\_source\_here.sh

```
#!/bin/sh
echo press enter to continue...
read need

if [ ! -d "WORKING_DIRECTORY_4.0.3" ]; then
mkdir WORKING_DIRECTORY_4.0.3
fi

echo alreadey maked the directory WORKING_DIRECTORY_4.0.3
echo press enter to list the files at /home/osvup/workspace
read need

echo ---------------START
ls -la ../../osvup/workspace/
echo ---------------END

echo are you sure you want to Extrea the WORKING_DIRECTORY_4.0.3.tar.gz file to here?\(y/n\)
read need
case $need in
y)
	echo you enter yes\(y\)
	tar -zxvf ../../osvup/workspace/WORKING_DIRECTORY_4.0.3.tar.gz -C ./WORKING_DIRECTORY_4.0.3
	;;
n)
	echo you enter no\(n\)
	;;
*)
	#do anything you want as default(direct enter)
	echo you enter neither yes\(y\) or no\(n\)
	;;
esac
```

02-build\_source.sh

```
#!/bin/sh
echo press enter key to continue...
read need
cd WORKING_DIRECTORY_4.0.3

#sudo dpkg-reconfigure dash
source build/envsetup.sh
lunch 1
make -j8
```

03-run\_emulator.sh

```
#!/bin/sh
echo press enter key to continue...
read need
cd WORKING_DIRECTORY_4.0.3

#sudo dpkg-reconfigure dash
source build/envsetup.sh
lunch 1
emulator &
```