繁体   English   中英

如何创建以下Android bash脚本?

[英]How can I create the following Android bash script?

当我输入:

adb devices

我的输出是(这可以是变量,可以列出10或20等):

List of devices attached 
0280414640c133d7    device
TA054085R1  device

之后,我想运行:

adb install MyApp 0280414640c133d7
adb install MyApp TA054085R1

如何在bash脚本中进行操作?

我不确定您需要的解决方案是否坚固,但是类似的方法适用于您上面描述的情况:

   #!/bin/bash

echo "Deploying SONR to devices..."

#install SONR
for foo in `adb devices | egrep 'device$' | cut -d ' ' -f1`
do
    adb -s $foo install SONR.apk
done

毫无疑问,用一次调用sedawk甚至是perl的单线替换丑陋的egrep cut管道就可以了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM