[dev-context] bash vs sh in installation script

Alan Braslau alan.braslau at cea.fr
Sun Apr 17 08:48:31 CEST 2011

On Sunday 17 April 2011 00:26:20 Mojca Miklavec wrote:
> On Sun, Apr 17, 2011 at 00:21, Mojca Miklavec wrote:
> > Hello,
> > 
> > Alan wrote me about the following issue. I don't know anything about
> > bash/sh issues (except that sh is indeed more likely to be present and
> > that I had to change many occurencies of /bin/sh to /bin/bash on
> > garden because /bin/sh was a symlink to dash which didn't work). Does
> > anyone object the change from bash to sh?
> Dear Alan,
> at the same time a question for you: do you also experience any issues
> with ./do-all.sh and other scripts in "build the latest binaries"? I
> just checked and they start with
>     #!/usr/bin/env bash
> How does that compare? (I agree that it probably makes sense to do the
> change, I just wanted to hear from others and maybe I need to find a
> good reference to what is not allowed in sh that works in bash.)
> On mac it is:
> > sh --version
> GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin10.0)
> Mojca

This is one solution that would probably work (if bash is present, but, again, 
it is not by default on many systems).

Another would be to write clean shell scripts, whenever possible, that do not 
rely on bash-isms, and would work everywhere, even with dash:

"DASH is a POSIX-compliant implementation of /bin/sh that aims to be as small 
as possible. It does this without sacrificing speed where possible. In fact, 
it is significantly faster than bash (the GNU Bourne-Again SHell) for most 

This should not be much of a constraint.

Alan Braslau
Orme des Merisiers
91191 Gif-sur-Yvette cedex FRANCE
tel: +33 1 69 08 73 15
fax: +33 1 69 08 87 86
mailto:alan.braslau at cea.fr

: :'  :
`. `'`

More information about the dev-context mailing list