Android:在非根目录设备上运行脚本 [英] Android: run a script on non-rooted device
问题描述
我可以在非root用户的设备上运行我的二进制可执行文件或脚本bash文件吗?
我有一个像这样的小脚本:
Can I run my binary executable file or script bash file on a non-rooted device? I have a small script like this:
#helloworld.sh
echo "hello world"
我将其保存在 / sdcard
中并尝试运行,但是我得到了权限被拒绝 。我研究过,原因是 SDCard
的执行权限被阻止。
I saved it in /sdcard
and try to run, but i got "Permission denied". I have researched, the reason is Execute permissions on the SDCard
is blocked.
是否可以运行?没有 SU
命令怎么办?我认为如果可以执行任何脚本文件将非常有帮助。
Is it possible to run? How can I do that without SU
command? I think it is very helpful if somehow can execute any script file.
推荐答案
哦,我可以在没有SU许可的情况下运行脚本,只需使用sh命令:
Oh, I can run my script without SU permission, just use sh command:
$ cd /sdcard
$ sh helloworld.sh
hello world
我认为我们不能对二进制可执行文件执行相同的操作。
I think we cannot do the same with a binary executable file.
这篇关于Android:在非根目录设备上运行脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!