Hacker News new | ask | show | jobs
by JdeBP 1126 days ago
All of this was covered in great detail in the 2000s, when Debian and Ubuntu switched /bin/sh to the Debian Almquist shell, which was basically POSIX-only with some 3 things that Debian people simply couldn't live without, and encouraged system scripts to use it. If you weren't around then, go and read the discussions. They're mostly still available, and they cover some important stuff that straw man counterarguments regularly miss.

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.

1 comments

>with some 3 things that Debian people simply couldn't live without

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.

Originally it was echo -n, local, and logical operators in test. There was just so much Debian stuff that assumed these.

* 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.