Image of the glider from the Game of Life by John Conway
Skip to content

DASH on Ubuntu

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.

{ 4 } Comments

  1. jldugger | June 27, 2008 at 4:20 pm | Permalink

    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.

  2. No One in Particular | June 27, 2008 at 4:21 pm | Permalink

    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.

  3. Aaron | June 30, 2008 at 9:08 am | Permalink


  4. Taylan | April 21, 2011 at 12:59 pm | Permalink

    Bash is surely quite "bloated" when compared to dash, but there will usually _not_ be too great of a speed increase in your boot time simply by switching to dash.

    Depends greatly on what your boot scripts do of course, you might just gain a whole or even two whole seconds.
    I'm half sarcastic half serious here. Two seconds is something, but you really won't get much more. If you do, your boot scripts are bloated themselves and so make the difference more apparent. 😛

    By the way dash has some few "BSD extensions" (as the manpage calls them) on top of posix; running on dash is not a fully reliable posix conformance test. Just saying.

    Another thing is that dash has some nasty bugs... At least one upstream as i'm writing this, i _just_ updated from git to be sure, don't know about Ubuntu/Debian versions though, maybe they're patched etc..

    Irrelevant note: I just realized the browser/OS information on top of each comment. Don't believe mine, i'm on Uzbl and have a different useragent string for compatibility! 😀

Post a Comment

Your email is never published nor shared.