3 ms·
That is, ironically, one of the main reasons I decided to switch to fish instead of zsh — it’s even less compatible with bash. I’ll never be in a position where
by pdpi 5y ago
That is, ironically, one of the main reasons I decided to switch to fish instead of zsh — it’s even less compatible with bash. I’ll never be in a position where a script is subtly broken because it’s running in zsh instead of bash. Rather, it’ll just fail altogether and I can work from there.
- arp242 5y ago> I’ll never be in a position where a script is subtly broken because it’s running in zsh instead of bash I would set the hashbang to "#!/usr/bin/env bash" and then bail out if $BASH_VERSION isn't set on the first line, while also naming the script "foo.bash" (rather than foo.sh). This way you can "enforce" a specific interpreter. Scripts using #!/bin/sh while relying on bash features was a common annoyance when I used FreeBSD – although it's probably less common now that some Linuxes have started using dash and /bin/sh. I don't mind if people use bash, but please make it explicit, especially because these types of errors are not necessarily obvious to the user.