如何创建以下 Android bash 脚本?
当我输入:
adb devices
我的输出是(这可以是变量,它可以列出 10 或 20 等):
List of devices attached
0280414640c133d7 device
TA054085R1 device
之后我想运行:
adb install MyApp 0280414640c133d7
adb install MyApp TA054085R1
如何在 bash 脚本中实现这一点?
When I type:
adb devices
My output is (this can be variable, it can list 10 or 20 etc):
List of devices attached
0280414640c133d7 device
TA054085R1 device
Afterwards I'd like to run:
adb install MyApp 0280414640c133d7
adb install MyApp TA054085R1
How can I get this going in a bash script?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定您需要您的解决方案有多强大,但是类似的事情将适用于您上面描述的情况:
毫无疑问,可以替换通过
cut 管道传输的丑陋
只需调用egrep
sed
或awk
甚至perl
单行代码即可。I'm not sure how robust you need your solution to be, but something like this will work with the case you describe above:
It is no doubt possible to replace the ugly
egrep
piped throughcut
with a single call tosed
orawk
or even aperl
one-liner.