I am currently trying to run a simple shell script via MacroDroid. devices are Huawei and Samsung (Oreo not rooted).
in MacroDroid tried following locations:
/data/local/tmp/script.sh
/storage/emulated/0/MacroDroid/script.sh
/storage/emulated/0/Android/data/com.arlosoft.macrodroid/files/script.sh
MacroDroid reports permission denied:
/system/bin/sh: <stdin>[4]: /data/local/tmp/script.sh: can't execute: Permission denied
/system/bin/sh: <stdin>[4]: /storage/emulated/0/MacroDroid/script.sh: can't execute: Permission denied
/system/bin/sh: <stdin>[4]: /storage/emulated/0/Android/data/com.arlosoft.macrodroid/files/script.sh: can't execute: Permission denied
the script itself is working when running from adb shell:
adb shell
$ cd /data/local/tmp
$ chmod 0755 script.sh
$ ls -nZ script.sh
-rwxr-xr-x 1 2000 2000 u:object_r:shell_data_file:s0 ...
$ ./script.sh
In Terminal Emulator the script is readable (and passing as argument to sh
works):
$ /data/local/tmp/script.sh
/system/bin/sh: /data/local/tmp/script.sh: not found
$ sh /data/local/tmp/script.sh
$ sh /storage/emulated/0/MacroDroid/script.sh
$ sh /storage/emulated/0/Android/data/com.arlosoft.macrodroid/files/script.sh
MacroDroid got all permissions granted in settings. Macros can create own log files in /storage/emulated/0
What is the proper location for shell scripts on non-rooted device?