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.

{ 3 } Comments

  1. jldugger using Mozilla Mozilla 1.9 on Linux Linux | 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.

    [Reply]

  2. No One in Particular using Mozilla Firefox Mozilla Firefox 1.5.0.12 on Windows Windows XP | 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.

    [Reply]

  3. Aaron using Mozilla Firefox Mozilla Firefox 3.0 on Linux Linux | June 30, 2008 at 9:08 am | Permalink

    test

    [Reply]

Post a Comment

Your email is never published nor shared. Required fields are marked *

Powered by WP Hashcash