繁体   English   中英

adb.exe: unknown command am adb.exe: unknown command sleep error 当我试图在我的根 android 设备上运行 shell 脚本时不断弹出

[英]adb.exe: unknown command am adb.exe: unknown command sleep error keeps poping up when am trying to run the shell script on my rooted android device

大家好,我是 shell 脚本的新手。如果表现得像个菜鸟,请不要介意。

当我尝试在我的 android 设备上运行 shell 脚本时,不断弹出以下错误

    #!/bin/bash
for i in $(seq 100) 
do  
echo "Time: $i"
adb -s $* shell am start com.android.camera/.Camera -W -S
adb -s $* shell sleep 3
adb -s $* shell input tap 540 1994
adb -s $* shell input tap 540 1994
adb -s $* shell input tap 540 1994
count=`adb -s $* shell ls /sdcard/DCIM/Camera/ | wc |awk '{print $1}'`
echo Count: $count
if [[ count -gt 500 ]]; then
break
fi
adb -s $* reboot
adb -s $* wait-for-device
adb -s $* shell sleep 40
adb -s $* shell input tap 500 1200
done

结果:adb.exe:未知命令 am adb.exe:未知命令睡眠

您无法在 android 设备上运行 adb 命令。 相反, adb 二进制文件必须安装在主机上。 该脚本是 linux 脚本,不能从 windows 运行。 准备可启动 usb flash 驱动器并从任何 linux 终端运行此脚本

此外,您的某些命令需要 root 权限。 因此sush必须被邀请(并且在触摸屏上的超级用户应用程序上授予权限)

adb shell su -c "am start com.android.camera/.Camera -W -S"

awk 在 android 上不可用。 为了更清楚地表明这些管道实际上是在主机上运行,请引用 android 命令(或者甚至更好地避免 awk)

count=$(adb shell "ls -1 /sdcard/DCIM/Camera" | wc | awk '{print $1}')
count=$(adb shell "ls -1 /sdcard/DCIM/Camera | wc -l")

am实际上是一个 shell 脚本指向am.jar这需要完全启动的 android。 如果您尝试在恢复模式下运行,您至少应该运行框架

暂无
暂无

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

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