4 ms·
I always use bash, because it's the only shell that is 100% compatible with bash. I've heard of some things not working in other shells, and since bash works f
by cabalamat 5y ago
I always use bash, because it's the only shell that is 100% compatible with bash.
I've heard of some things not working in other shells, and since bash works for the things I use it for, I have no reason to change.
- pdpi 5y agoThat 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.