1) android 样机上如何 建立 运行 .sh 文件?这个.sh 文件如何建立呢? 以下这样建立,运行时./test.sh, 没见到效果(不会删除文件1).
***********test.sh***********
#!/bin/sh
rm /home/1
***********test.sh***********
2) Ubuntu 命令行环境下, 如何 建立 运行 .sh 文件?这个.sh 文件如何建立呢? 以下这样建立,运行时./test.sh, 没见到效果(不会删除文件1).
***********test.sh***********
#!/bin/sh
rm /home/1
***********test.sh***********
***********test.sh***********
#!/bin/sh
rm /home/1
***********test.sh***********
2) Ubuntu 命令行环境下, 如何 建立 运行 .sh 文件?这个.sh 文件如何建立呢? 以下这样建立,运行时./test.sh, 没见到效果(不会删除文件1).
***********test.sh***********
#!/bin/sh
rm /home/1
***********test.sh***********
#!/system/bin/busybox shecho "do ........ job"
BUSYBOX="/system/bin/busybox" # copy android modify tool files
mkdir /mnt/huabin
$BUSYBOX cp /system/testsend.sh /mnt/huabin/testsend.shecho "....... ok"
*********ins.sh********************************************在样机上, 以下代码,执行不了以上ins.sh 文件 (ins.sh 手动赋给它了可读写可执行的权限) Runtime ex = Runtime.getRuntime();
String cmdFile = "busybox /system/ins.sh";
String cmdBecomeSu = "su";
String script = "busybox chmod a+rw /system/ins.sh";
java.lang.Process runsum = null;
try {
runsum = ex.exec(cmdBecomeSu);
Log.e("Debug", "...Successfully to su");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
int exitVal = 0;
final OutputStreamWriter out = new OutputStreamWriter(runsum.getOutputStream()); //**************************************************
// Write the script to be executed
try {
out.write(cmdFile);
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
Log.e("Debug", "...1.....");
} // Ensure that the last character is an "enter"
try {
out.write("\n");
out.flush();
Log.e("Debug", "...Successfully.....");
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
Log.e("Debug", "...2.....");
}
try {
// Terminate the "su" process
out.write("exit\n");
out.flush();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
Log.e("Debug", "...3.....");
}
//**************************************************
: applet not found