4 ms·
What level of portability do you deem necessary for what you do? I rarely encounter a box that has sh but not bash, but maybe that’s just me.
by Cederfjard 5y ago
What level of portability do you deem necessary for what you do? I rarely encounter a box that has sh but not bash, but maybe that’s just me.
- klodolph 5y agoI could equally ask, "What level of Bash features do you deem necessary for what you do? I rarely encounter a shell script that cannot be trivially modified to work on POSIX /bin/sh." At least historically speaking, Bash was noticeably slower than Dash. It's the slowest shell. If you are doing things like, say, build scripts in a CI environment where you need to execute shell scripts thousands of times or more, the 4x difference can make a real impact on user experience. Same thing during startup, back before the transition to Systemd, when Debian changed the /bin/sh alias to point to Dash instead of Bash to speed up system startup. https://unix.stackexchange.com/questions/148035/is-dash-or-some-other-shell-faster-than-bash https://unix.stackexchange.com/questions/148035/is-dash-or-s... https://wiki.ubuntu.com/DashAsBinSh https://wiki.ubuntu.com/DashAsBinSh At some point, shell scripts reach a level of complexity where most people choose to rewrite them in a higher-level language, often Python or Perl, or maybe even Go. My personal experience is that the Bash-isms, although kind of nice, don't really shift that threshold... like, although Bash has arrays, but if I need to manipulate arrays, I switch to Perl or Python. If I just need to pull elements out of one array, I can do that portably.