Bash Script shebang Env shebang


To execute a script file with the bash executable found in the PATH environment variable by using the executable env, the first line of a script file must indicate the absolute path to the env executable with the argument bash:

#!/usr/bin/env bash

The env path in the shebang is resolved and used only if a script is directly launch like this:

The script must have execution permission.

The shebang is ignored when a bash interpreter is explicitly indicated to execute a script: