Yes

Mac@programming.dev to Programmer Humor@programming.dev – 774 points –
79

You are viewing a single comment

Still don't do this. If you use bash specific syntax with this head, that's a bashism and causes issues with people using zsh for example. Or with Debian/*buntu, who use dash as init shell.

Just use #!/bin/bash or #!/usr/bin/env bash if you're funny.

#!/bin/bash doesn't work on NixOS since bash is in the nix store somewhere, #!/usr/bin/env bash resolves the correct location regardless of where bash is

Are there any distos with /usr/bin/env in a different spot? I still believe that's the best approach for getting bash.

4 more...
4 more...

/bin/bash won't work on every system for example NixOS some other systems may have bash in /usr/bin or elsewhere

NixOS didn't do /usr merge?

Binaries are not in /usr/bin or /bin except for /bin/sh and /usr/bin/env. Programs should not assume fixed paths for binaries and instead look for them in $PATH.

4 more...