adb shell 从同一个 cmd 窗口运行多个命令 [英] adb shell running multiple commands from same cmd window

查看:142
本文介绍了adb shell 从同一个 cmd 窗口运行多个命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个 Perl 脚本来通过 adb shell 运行一组命令.

I am trying to create a Perl script to run set of commands through adb shell.

cmd1 
cmd2 
cmd3 
cmd3(1)

我将所有命令放在一个文本文件中并像这样运行:adb shell <adb_commands.txt.(参考)

I put all the commands in a text file and ran it like this: adb shell < adb_commands.txt.(reference)

但是,我有一个问题,需要从上一个命令 cmd3 中执行最后一个命令 cmd3(1).
因此 cmd3 将被执行并等待 cmd3(1) 输入.这不会发生,因为据我所知,adb shell 正在等待 cmd3 完成,以便它可以运行 cmd3(1).

However, I have this one issue where the last command cmd3(1) needs to be executed from within the previous command cmd3.
So cmd3 will be executed and will wait for cmd3(1) to be entered. This is not happening coz as far as i can tell, adb shell is waiting for cmd3 to finish so it can run cmd3(1).

有人可以就如何解决此问题或是否有其他替代方法提出建议吗?

Can someone please advise on how to solve this issue or if there are any alternate ways to do this?

谢谢.

推荐答案

使用 &不是 &&

Use & not &&

&&仅当上一个成功时才运行下一个命令

&& run next command only if the previous were successful

&无论成功与否,都在上一个完成后运行下一个命令

& run next command after the previous finish no matter successful or not

这篇关于adb shell 从同一个 cmd 窗口运行多个命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆