7 ms·
As you should. Bash --- at least bash 3.x --- is available literally everywhere and has many features essential for robust programming, like local variables. In
by quotemstr 6y ago
As you should. Bash --- at least bash 3.x --- is available literally everywhere and has many features essential for robust programming, like local variables. Instead of writing for some antique shell, we should all just write for bash or zsh or something modern. I don't care about being compatible with some random AIX installation that's from 1870 and powered by a steam engine.
- jgtrosh 6y agoIt is however useful to know the difference, and in some cases you actually need to write POSIX (code meant to be sourced for example).
- umanwizard 6y agoOne counterexample: bash isn’t available in the base system of typical BSD variants (though, yes, you can install it from ports).
- trasz 6y agoThis would make sense if it said "zsh" instead. Not only is only better in terms of features, it's also released under a non-problematic Open Source license.
- klodolph 6y agoIf I want to use modern features, I’ll just use Perl or Python, both of which are also available literally everywhere.
- dimitrios1 6y agoOr I'll just write it in Go and easily cross compile an execuable binary for whatever platform I need.
- saagarjha 6y agosh is used because it is POSIX sh–you know it will work not "literally everywhere" but really, truly, literally everywhere. And your bashisms aren't going to do all that well on BusyBox, or dash. Just because you don't care doesn't mean that we should make incompatible scripts and not be aware that we are doing so.
- wl 6y agoI've worked on storage-constrained embedded systems where adding bash and its dependencies expanded my root filesystem by 50%. busybox ash is a much smaller alternative.
- scoopertrooper 6y agoSecurity teams love stripping bash out of linux images. I was forced into living a pure sh diet while working for a bank.
- nucleardog 6y agoAs others have mentioned... not everywhere. And sometimes you’re just writing something that really shouldn’t require a dependency on bash. You wouldn’t write a Python script to run a few quick shell commands like copying a few files around. Same concept.