I ran into some issues when running some installation scripts where they complained of bad interpreter
.
So I made a trivial example but I can't figure out what the problem is, see below.
#!/usr/bin/env bash
echo "hello"
Executing the script above results in the following error
[root@ech-10-24-130-154 dc-user]# ./junk.sh
bash: ./junk.sh: /usr/bin/env: bad interpreter: No such file or directory
The /usr/bin/env
file exists, see below:
[root@ech-10-24-130-154 dc-user]# ls -l /usr/bin/env
lrwxrwxrwx 1 root root 13 Jan 27 04:14 /usr/bin/env -> ../../bin/env
[root@ech-10-24-130-154 dc-user]# ls -l /bin/env
-rwxr-xr-x 1 root root 23832 Jul 16 2014 /bin/env
[root@ech-10-24-130-154 dc-user]#
If I alter the script to use the regular shebang #!/bin/bash
it works no problem. #!/bin/env bash
works as well.
What is missing from the environment to allow the portable shebang to work?
ls -lL /usr/bin/env
returns ls: cannot access /usr/bin/env: No such file or directory
so I guess I need to alter the symbolic link? Can I point it to /bin/env
?
env --version
is 8.4 and the OS is Red Hat Enterprise Linux Server release 6.6.