分页: 1 / 1

请教:bash里执行一个程序后,如何再给这个程序传递命令?

发表于 : 2013-02-24 14:55
szl1997
如题。比如用“echo su | adb shell "或者”adb shell `echo su`“启动adb shell并进入su后如何再给adb shell 传递其他的命令执行呢?

Re: 请教:bash里执行一个程序后,如何再给这个程序传递命令?

发表于 : 2013-02-25 10:11
szl1997
自己顶一下!比如要用bash脚本察看手机里都安装了哪些应用,可以在adb shell里“ls /data/app”。但这需要root权限。终端里可以打开adb shell后先su取得root权限然后再ls,但在脚本里面该如何实现呢?

Re: 请教:bash里执行一个程序后,如何再给这个程序传递命令?

发表于 : 2013-02-25 10:44
eexpress
你应该ssh登录进去,登录时候,就直接使用root帐号。
sudo才带密码的参数。

Re: 请教:bash里执行一个程序后,如何再给这个程序传递命令?

发表于 : 2013-02-26 19:34
szl1997
:em03 大神,其实我想问的是脚本里面执行了一个程序,但这个程序有交互的话如何用脚本自动实现。。。。。
(貌似说expect可以?,不过有没有简单点的方法?)

Re: 请教:bash里执行一个程序后,如何再给这个程序传递命令?

发表于 : 2013-02-26 20:22
forestchen
这里有解答 http://stackoverflow.com/questions/8761 ... hrough-adb
adb shell "su -c 'command1; command2, command3'"

Re: 请教:bash里执行一个程序后,如何再给这个程序传递命令?

发表于 : 2013-02-26 22:09
szl1997
forestchen 写了:这里有解答 http://stackoverflow.com/questions/8761 ... hrough-adb
adb shell "su -c 'command1; command2, command3'"
:em11 多谢!