Skip to main content

Problems with shell (sh) scripts on Ubuntu Edgy Eft? Find the fix here!

I use Ubuntu at work and recently upgrade from 6.0.6 (Dapper Drake) to 6.10 (Edgy Eft).

Today I found a problem with an SQL tool that we use - Oracle's SQLDeveloper. It runs from a shell script and was failing with a very strange error (it couldn't find a config file). After some head scratching and searching on the web I found the reason why:

Previous versions of Ubuntu (and probably most distributions of Linux) map sh to bash. Bash has more features and many scripts are written with Bash in mind.

Ubuntu 6.10 has changed this so that sh now uses dash - a faster-than-bash alternative that only supports what the original sh did. There is even an outstanding Ubuntu bug regarding this.

This was the reason why my script was failing - it was assuming a bash shell even though it mentioned #!/bin/sh at the top of the script, and dash just doesn't have bash's features.

The fix was simple:

In the /bin directory sh is linked to dash so you just need to update the link to point back to Bash:

cd /bin
sudo ln -sf bash sh


After that simple change SQLDeveloper fired right up!

Technorati Tags: , , , , , ,

Comments

mitch_76 said…
thanks. you saved me a lot of time. cheers, michele