by spyremeown · 3y ago · 0 comments
I don't buy this argument. Ok, it's a standard, but sometimes it's a pain-in-the-hole standard. Bash augmentations lessen some of the pains, and it's just nicer. The only situation is if you're using busybox in a very limited system or you reeeeeally need your script to run on many difference unices, which let's be honest, is not that common nowadays.
The Debian people were concerned, for starters, with how much time the Bourne Again shell spent, at process initialization, setting up things for extensions and interactive features that were never employed in non-interactive "sh" mode; a significant cause for concern given how much of the system was executable shell scripts.
Curious, what are the 3 things ?
But yes, people should always use sh (or ksh) for scripting as opposed to bash, why, it is far more portable to other systems.
* https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294962
They've added 2 more since.
* https://www.debian.org/doc/debian-policy/ch-files.html#scrip...
Strictly speaking, there are other differences between the Debian Almquist shell and a truly SUS conformant sh.
* https://unix.stackexchange.com/q/697007/5132
But the aforementioned are what Debian people explicitly wanted and couldn't live without. Note that the StackExchange answer is a comparison of a 2022 dash to a 2017 standard, neither of which existed at the time. Debian Policy, the Debian Almquist shell, and the POSIX standard have all been revised since then.
Due to docker, minimalistic Linux'es have been more common, including trimmed-down versions of distros that would otherwise feature bash.
Both sh and bash are terrible, ugly hacks. Anything that requires more than 3 lines of them (including the #! line) should be written in a proper scripting language.
Though I do agree that cross-platformity to that level is rarely meaningful, and so things like python are just as likely available/can be made available.
I'm not sure there is a good alternative to sh/bash shell scripts as most dynamic languages have become pretty large dependencies these days.
Any way for: python - 75M perl - 59M ruby - 25M bash - 8M dash - 0.15M
...that said, having to support bash 3.2 for MacOS is a horrible thing.
But I know that you meant it as a rhetoric, so my non-rhetorical answer would be that python3 is almost universally available on distros that are not minified deliberately (containers).
Writing control scripts for use inside containers is currently my biggest application of BASH scripts. What makes BASH (or other shells) handy is the lack of supporting files that are needed - just copy in the script and you're ready to go.
Which version of Bash?