[GRASS-dev] Re: grass-dev Digest, Vol 10, Issue 46

Hamish hamish_nospam at yahoo.com
Tue Feb 20 00:29:16 EST 2007


Hamish wrote:
> but the r.tileset script makes Heavy use of SIZE_ARRAY[0]="" style
> Bash arrays, so I fear it will need to be totally rewritten or
> declared "Bash only".  Is this enough for such a test?
> 
> if [ "`basename $SHELL`" != "bash" ] ; then
>    echo "$0: This script requires Bash" 2>&1
>    exit 1
> fi
> 
> (apparently not, starting ash from the bash prompt preserved $SHELL
> as /bin/bash; but maybe it helps catch real world cases? I guess the
> real issue is testing what the /bin/sh symlink points to. I guess
> Init.sh could run a little test and set GRASS_HAVE_BASH=1, but it
> is better to just fix r.tileset)


how about:

BASH_TEST[0]="" 2> /dev/null
if [ $? -ne 0 ] ; then
   echo "$0: This script requires Bash" 2>&1
   exit 1
fi


or just change the shebang to #!/bin/bash  and let folks with it
in /usr/bin/bash or /usr/local/bin/bash live with the pain?


Hamish




More information about the grass-dev mailing list