Ubuntu’s shell != bash, and how to fix your scripts

November 15, 2010

I just found out that on Ubuntu, /bin/sh is a symlink to /bin/dash, not to /bin/bash.  Apparently this was changed to make booting up a little bit faster.

In any case, it might mean that many of your scripts won’t work because they are starting with ‘#!/bin/sh’.  Instead, you should have them point directly to /bin/bash.  Here’s a one line script that will update all the scripts in a directory:

find . -type f | xargs sed -i ‘s_#!/bin/sh_!/bin/bash_’

2 Responses to “Ubuntu’s shell != bash, and how to fix your scripts”

  1. Q Says:

    Thank you for that – exactly what I was looking for 🙂
    / KingNeutron

  2. Cash Loans Says:

    There is definately a lot to find out about this issue.
    I like all of the points you have made.


Comments are closed.