ADB睡眠功能可在ADB上使用,但不能在.sh文件中使用 [英] Adb sleep function working on adb but not in a .sh file
问题描述
我正在尝试制作一个简单的点击并等待"脚本,以通过adb在我的Android设备上运行.
i am trying to make a simple "tap and wait" script to run on my Android device through adb.
使用命令 ./adb shell
在Powershell上打开adb起作用,运行 input tap 300 300
起作用,并且运行 sleep 1
进入睡眠状态一秒钟.
Opening adb on Powershell with the command ./adb shell
works, running input tap 300 300
works, and running sleep 1
does sleep for a second.
但是,如果我使用Powershell命令运行
敲击部分仍然可以,但是 test.sh
脚本./adbshell"sh/sdcard/Download/test.sh" sleep
调用给了我这个:'sdcard/Download/MIOPROGRAMMA.sh [2]:sleep:语法错误:无效参数'1
.
However, if I run a test.sh
script with the Powershell command ./adb shell "sh /sdcard/Download/test.sh"
the tapping part still works, but the sleep
call gives me this instead: 'sdcard/Download/MIOPROGRAMMA.sh[2]: sleep: syntax error: Invalid argument '1
.
知道为什么会这样吗?
推荐答案
只需在 int
后添加;
,即:
input tap 250 250
sleep 3;
input tap 350 250
sleep 3;
input tap 450 250
sleep 3;
input tap 550 250
sleep 3;
input tap 650 250
sleep 3;
这篇关于ADB睡眠功能可在ADB上使用,但不能在.sh文件中使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!