3 ms·
>Are there any situations where you wouldn't be able to find bash in /bin/bash? Basically everything that isn't a typical gnu/linux distro or osx. Bash is not
by copergi 12y ago
>Are there any situations where you wouldn't be able to find bash in /bin/bash?
Basically everything that isn't a typical gnu/linux distro or osx. Bash is not a standard tool, it is a gnu specific shell. Posix requires env to exist, and requires it to exist in /usr/bin/. If you are using bashisms, then using /usr/bin/env bash will let people without bash see that your script is a bash script, and install bash to solve the problem. If you hardcode /bin/bash they have to fix your script.
> is the lowest common denominator /usr/bin/env or is it /bin/sh
Ideally you should use /bin/sh of course. But it is missing functionality some people want to use, so in that case using bash the portable way is preferred over using bash the unportable way.