Not all distros have bash in /bin/bash. In fact, most distros are moving binaries away from /bin and into /usr/bin (even Debian!). But still, not all distros have bash in /bin or /usr/bin. However, pretty much all of them have env in /usr/bin. /usr/bin/env bash searches $PATH for the bash executable, and is the most portable shebang to use.
I.e., on OpenBSD, you find bash in /usr/bin/local/bash, and there is no /bin/bash, so autopostgresql fails before it even starts.
Not all distros have bash in
/bin/bash
. In fact, most distros are moving binaries away from/bin
and into/usr/bin
(even Debian!). But still, not all distros have bash in/bin
or/usr/bin
. However, pretty much all of them haveenv
in/usr/bin
./usr/bin/env bash
searches$PATH
for the bash executable, and is the most portable shebang to use.I.e., on OpenBSD, you find bash in
/usr/bin/local/bash
, and there is no/bin/bash
, so autopostgresql fails before it even starts./usr/bin/env bash
seems to be best practice :).