Termux-app: Running programs that use /use/bin/env

Created on 29 Dec 2017  路  5Comments  路  Source: termux/termux-app

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?

Most helpful comment

termux-exec takes care of this. Install with pkg install termux-exec, see the sources for more information.

All 5 comments

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).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ngroup picture ngroup  路  5Comments

christianrondeau picture christianrondeau  路  4Comments

nedz14 picture nedz14  路  4Comments

darth-cequella picture darth-cequella  路  3Comments

msh2050 picture msh2050  路  4Comments