Make sure that the current working directory matches the directory of the file. I guess you moved the file to /sdcard/filename. Termux, by default, starts somewhere like /data/data/com.termux/files/home/termux.
You can’t make external storage file executable. If your file on external storage either move it to termux home directory or execute like this bash filename
" You can’t make external storage file executable. If your file on external storage either move it to termux home directory or execute like this bash filename"
Thanks shubhamtyagi
Yes, I can run the script if I use… bash filename
or sh filename
(whether it is executable or not)
“filename” is in “shared” directory not “termux home” directory.
“termux home” directory is higher up the hierarchy than “shared”.
I don’t think that I can put files in “termux home” because it doesn’t show in my file manager.
Maybe I would need a rooted phone to do that.
I suppose that “storage” and “storage/shared” is viewed as “external storage” by Termux.
See the hierarchy…
files → home → storage → shared → “filename”
$ ls
app_textures code_cache shared_prefs
app_webview files
cache lib
$ cd files
$ ls
home usr
$ cd home
$ ls
storage
$ cd storage
$ ls
dcim movies pictures
downloads music shared
$ cd shared
$ ls
Android Movies Xiaomi
DCIM Music fac_sources
Documents Pictures filename
Download Scripts
MIUI SoundRecorder
$ bash filename
Hello World
$ sh filename
Hello World
$