[GRASS-dev] [bug #5499] (grass) bash scripts starting with
#!/bin/sh
Glynn Clements
glynn at gclements.plus.com
Tue Feb 27 15:03:52 EST 2007
Hamish wrote:
> > > 2) keep #!/bin/sh, but add this within the script:
> > >
> > > if [ -z "$BASH" ] ; then
> > > echo "$0: This script requires Bash." 1>&2
> > > exit 1
> > > fi
> >
> > Or:
> > if [ -z "$BASH" ] ; then
> > exec bash "$0" "$@"
> > echo "$0: This script requires Bash." 1>&2
> > exit 1
> > fi
> >
> > AFAICT, that should work so long as bash is called "bash" (and not
> > e.g. "bash2" or "bash-3.1.17") and is somewhere in the path.
>
> should we worry about the case where bash has been symlinked to ash
> and the thing loops?
No. It *could* happen, but it seems extremely unlikely.
I can't see what benefit symlinking bash to ash would achieve; any
script with #!/bin/bash (etc) is almost certain not to work with ash.
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev
mailing list