4 ms·
Is comparability with sh really a worthwhile goal anymore? I haven’t seen many places with sh but not full bash (busybox being the main exemptions but that bre
by AlphaSite 5y ago
Is comparability with sh really a worthwhile goal anymore?
I haven’t seen many places with sh but not full bash (busybox being the main exemptions but that breaks most things due to muslc anyway).
- 1vuio0pswjnm7 5y agoWhat OS are you using. It may use bash for login, but I would be willing to bet it does not use bash for scripting (non-interactive use). It is possible that many shell script authors do not understand the difference between a login shell (optimised for interactive use) and a scripting shell (optimised for non-interactive use). Thus the comparison could be worthwhile. sh is faster, more portable and arguably presents fewer potential gotchas. FWIW, shellschock affected bash but not sh. NetBSD uses ash-derived sh as both login and scripting shell. No bash. Debian and many, many other GNU/Linux distributions (including musl-based Void) all use NetBSD-derived sh called "dash" as the default scripting shell. I am not aware of any Berkeley distribution that uses bash as the default scripting shell.
- nerdponx 5y agoSo use a shebang that specifies Bash, or invoke it with `bash` on the CLI. The default scripting shell might be important for typing like X11 startup scripts, but I don't see why you have to use it for standalone scripts just because it's the default.