ADB睡眠功能可在ADB上使用,但不能在.sh文件中使用 [英] Adb sleep function working on adb but not in a .sh file

查看:86
本文介绍了ADB睡眠功能可在ADB上使用,但不能在.sh文件中使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试制作一个简单的点击并等待"脚本,以通过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 1does sleep for a second.

但是,如果我使用Powershell命令运行 test.sh 脚本./adbshel​​l"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屋!

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