Open Script with Termux

I have installed Termux on my rooted Fairphone 2 (Fairphone Open).

How can I run a script I have written in Termux by tapping it in Amaze? When I open it with Termux, it only asks me to save the script somewhere…

What are its permissions? And probably also the first line?

ls -la brings

“-rw-rw---- 1 root everybody …

The first (and currently only) line is “echo Hallo<LF>”

For being executable permissions have to include x.
In termux, do a “chmod 775” (without quotes). But, as far as I know, you can’t change permissions everywhere. Probably you have to move the script somewhere else (/storage/emulated/0)?
Also, the first line should probably be


1 Like

Just stumbled over that. :frowning: All my "chmod 777"s were in vain.

In /storage/emulated/0, it doesn’t work as well (chmods have no effect). Where do I have to move the file to?

According to you have to move it to the $HOME directory of Termux (which probably is somewhere in /storage/emulated/0/Android/data//…

a pwd inside termux will reveal the location and you can use amaze to move the file there & change the permissions (774 should be enough :slight_smile: ).

Actually, it’s /data/data/com.termux/files/home :wink:
And yes, moving scripts there does help to launch them from Termux.

But I’m not sure about tapping the script file in a file manager to launch them - I know this works e.g. in dolphin on kde. For me, it does not work to launch the script by tapping it in Amaze, choosing “other” as file type and then selecting Termux to open it. I get the exact same dialog as @hansibert. It seems to me this functionality is just missing in Termux.

It works! Without tapping though, but with typing. :wink:

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.