Search notes:

shebang

A shebang allows to execute a non-binary file (i. e. a script) with a given interpreter.
The shebang is located in the script's first line and consists of #! followed by the path (relative or absolute) to the interpreter
#!/usr/bin/perl
…
If the interpreter is not found, the error bad interpreter: No such file or directory is thrown.

Using an interpreter whose absolute or relative path is not known

Sometimes, the exact path to the interpreter is not known, for example when using a virtual environment such as venv in Python.
In such a case, env (whose location is known) to locate the interpeter:
#!/usr/bin/env python
…

#!/hint/bash is a phony shebang used to provide a hint to text editors that the file content is using bash syntax, for example in /etc/makepkg.conf.

See also

The execution of files with shebangs seem to be hanled by the Linux source file fs/binfmt_script.c.
pathfix.py, located under the Python installation directory Tools/scripts, changes shebangs in Python scripts.

Index