use*_*001 1 linux bash shell android
我在为仅在设备 (/system/bin/sh) 中存在的 sh 上运行的 android 设备编写 shell 脚本时遇到问题。我写了以下脚本
#!/system/bin/sh
while [ 1 ]; do
cat /sys/kernel/debug/gpio > /dev/kmsg
sleep 2
done
Run Code Online (Sandbox Code Playgroud)
如果我通过以下命令运行 shell,它无法找到system/bin/sh
root@xyz3g:/data # ./test_script.sh
/system/bin/sh: ./test_script.sh:它给出的 No such file or directory
上述错误的可能原因是什么?
因此,如果我通过以下命令运行此脚本,则会收到语法错误。
test_script.sh[2]: syntax error: 'while' unmatched
Run Code Online (Sandbox Code Playgroud)
我已经确认了语法,但无法从中得到任何想法。你能帮我解决这个问题吗,因为我是 shell 脚本的业余爱好者。
in regards of permissions and other applications如果我在有根的三星设备和谷歌发布的手机(如 NEXUS 4、NEXUS 5)中运行此脚本,我是否知道是否存在差异()提前致谢。