Ubuntu 7.04 (Feisty Fawn) shell problems

Here’s a little gotcha for anyone using Ubuntu 7.04 (it might have been in 6.10 too, I’m not sure) and some amount of shell scripting.

If you refer to /bin/sh anywhere, Ubuntu out of the box points to a shell called dash and not (as would normally be the case) bash. Dash doesn’t have all the features bash has though (the flip side is that it’s a lot faster, apparently), so in some cases (including a few I just ran into) your scripts may cease to work.

The solution? Change your scripts to explicitly use /bin/bash or use the sledgehammer approach and relink /bin/sh to /bin/bash.

And yes, despite going point-haired, I haven’t escaped from the land of build monkey.

Advertisements

2 thoughts on “Ubuntu 7.04 (Feisty Fawn) shell problems”

  1. You shouldn’t use bash features in a script that runs /bin/sh. A “#!/bin/sh” line at the start of the script is a guarantee of posix compliance and portability. If you want to use bash, put /bin/bash in the hash-bang line.

  2. I agree, so the most-correct but unwritten third option would be to correct the scripts to only use /bin/sh features.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s