A couple recent posts have started on the Utah Open Source Planet regarding popd and pushd not being available on a default Ubuntu install. As discovered, popd and pushd are shell built-ins for the BASH shell, and not provided by the Debian Almquist Shell (DASH). Why has Ubuntu made the change from BASH to DASH as the default shell? Well, there some reasons for it, as identified by the Ubuntu Wiki.
BASH is full-featured bloat. Yes, bloat. If System V Init scripts are relying on BASH to start their service, your boot process will be slower. DASH, in comparison is light and snappy, thus greatly improving the time it takes your computer to boot. If your scripts are adhering to POSIX standards, and are using /bin/sh rather than /bin/bash, you shouldn’t notice any problems. However, if your scripts are relying on /bin/bash features, such as popd or pushd, and you change the interpreter at the top of your script to /bin/sh, you’ll have some breakage.
For what it’s worth, this isn’t anything new with 8.04. DASH became the default in Ubuntu with 6.10, so we’ve had it in this manner for some time. If you would like to change it, then point the symbolic link from /bin/sh to /bin/bash rather than /bin/dash, and you’re done. However, as you may have noticed, it could cause some breakage if you Bourne-compatible scripts contain “Bashisms”.
Personally, I recommend the Z-shell (ZSH) to anyone looking for an alternative to DASH or BASH. Much more capable, flexible and configurable shell.

{ 3 } Comments
Isn’t bash installed by default? Users should still have bash as their default shell, and like you mention, just changing /bin/sh to /bin/bash will work if you’re not willing to remove bashisms.
[Reply]
Bash isn’t an apt-get away, it’s installed by default! (in ubuntu-minimal)
The issue is /bin/sh is linked to dash. (Dash is used for scripts, bash is the shell by default)
Your friends with the scripting problem need only redirect their shebang to /bin/bash, and all their problems will be solved.
If they ask for /bin/sh, they can’t expect it to be bash, since… they’re asking for anything that does scripts (including zsh, tsh, whatever). Not bash scripts.
Effectively, their shebangs are lying about what language the script is.
[Reply]
test
[Reply]
Post a Comment