[GRASS-dev] [bug #5499] (grass) bash scripts starting with #!/bin/sh

Glynn Clements glynn at gclements.plus.com
Wed Feb 21 02:53:00 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.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list