This is a very interesting question – and the resolution is simple. In Ubuntu 6.10 (known as Edgy Eft) the decision was made to replace the Bourne Again Shell (
bash) with the Debian Almquist Shell (or
/bin/sh in Ubuntu. There was considerable uproar in Ubuntu brainstorm (community ideas) and in Ubuntu bug reports, as using dash instead of the original bash caused numerous scripts to break.
In particular, the entire reasoning given for this change was efficiency: dash is more efficient (i.e., faster) than bash. According to the explanatory document created by the Ubuntu developer team, Debian has required scripts to work on POSIX-compliant shells for some time (even pre-dating the Ubuntu project). Thus, any scripts that broke were, in essence, not “following directions” and deserved what they got.
To undo this change by the Ubuntu team, one can do this:
sudo dpkg-reconfigure dash
When this command executes, specify that you do not want
dash to act as
/bin/sh. This will make every script that runs
bash as has traditionally been the case.
You can also make your scripts run
/bin/bash instead of
/bin/sh; this provides all of the bash capabilities without any concern as to whether
/bin/sh will change again.
Making the boot process faster is a laudable goal, but like the removal of OSS from the kernel, it caused a lot of problems for users.
In both cases, it appears that the Ubuntu team is more focused on doing the technologically “right” thing rather than providing a stable and reliable platform. Unfortunately, this means that you cannot rely on Ubuntu to stay reliable – at least from one version to the next. The response of Ubuntu to such system failures has always been that they are doing the “right” thing and the problem must be fixed by someone else (i.e., it’s not Ubuntu’s problem).
Users – many of them system administrators – take the brunt of this: they don’t care whose fault it is, nor do they care whether the boot process is faster or whether the Linux sound environment is “cleaner”; they care about the stability of their systems. A system that boots faster doesn’t matter if it crashes during the boot process because of a broken script.
If the focus of Ubuntu were to provide a stable and unchanging environment, then their decisions would be different – and would result in an improved customer experience.
3 thoughts on “Why doesn’t my /bin/sh script run under Ubuntu?”
It’s just a matter of using the right shebang.
its just a matter of not using ubuntu. it pretty good for avarage user, but not that good for geeks and enthusiasts.
I would disagree – and invert that statement. The average user just wants things to work; it is the geek and enthusiasts that can fix problems like this. Your statement also doesn’t mention system administrators in a corporate environment; when running Ubuntu Server one expects things to be stable.
In spite of this rant, I’d say that Ubuntu remains a fantastic distribution to use – each distro has its benefits and its disadvantages.