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:


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?


1 Answer 1


Shell script Action is somewhat misleading in itself. It should be renamed as "Shell commands" instead. In the input area you are required to input the whole of your script actually. If you don't want that but wants to run an already made script instead, run it as

sh /sdcard/my_script.sh     # example

This should work.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .