Some executable scripts start with
#!/use/bin/env
but when trying to run them in Termux it results in an error that env is missing:
$ serve .
bash: /data/data/com.termux/files/usr/bin/serve: /usr/bin/env: bad interpreter: No such file or directory
So I have to run it like this:
$ node /data/data/com.termux/files/usr/bin/serve .
How can we fix this?
I found at https://github.com/termux/termux-app/issues/228 that I can use termux-fix-shebang to fix a specific file.
This can be tedious to do for all scripts. Is there not a more permanent way that can work with current or future files without further intervention?
termux-exec takes care of this. Install with pkg install termux-exec, see the sources for more information.
Sweet! Thanks!
/usr/bin/env should be followed by an environment name such as
/usr/bin/env bash
/usr/bin/env php
/usr/bin/env python
The command is doing the right thing and it sounds like your shell scripts shebang strings are wrong.
It is infact the prefered way of runing shells as it makes them independent of the location of the executing program.
Termux is not FHS-compliant and shebangs like /usr/bin/env are wrong here (if shell is not running under termux-exec LD_PRELOAD wrapper).
Most helpful comment
termux-exec takes care of this. Install with
pkg install termux-exec, see the sources for more information.