> # look for Java location
> if [ -n $JAVA_HOME ] ; then
>       JAVALOC=$JAVA_HOME
> else
>       if [ -n $JAVA_PATH] ; then
>               JAVALOC=$JAVA_PATH
>       else
>               if [ -n $JDK_HOME] ; then
>                       JAVALOC=$JDK_HOME
>               else
>                       if [ -n $JDK_PATH] ; then
>                               JAVALOC=$JDK_PATH
>                       fi
>               fi
>       fi
> fi

you should add a ' ' before ending ']'.
Also, let me remind you that this script is WRONG:
lpnp69 ~  /bin/sh
sh-2.04$ cat > a.sh
if [ -n $TOTO ] ; then
  echo "toto"
fi
sh-2.04$ chmod +x a.sh
sh-2.04$ ./a.sh 
toto
sh-2.04$ cat > b.sh
if [ -n "$TOTO" ] ; then
  echo "toto"
fi
sh-2.04$ chmod +x b.sh
sh-2.04$ ./b.sh 
sh-2.04$ export TOTO=""
sh-2.04$ ./a.sh 
toto
sh-2.04$ ./b.sh 
sh-2.04$ export TOTO=x
sh-2.04$ ./a.sh 
toto
sh-2.04$ ./b.sh 
toto


[ -n $VAR ] is ALWAYS true, whatever the value of $VAR, as if it is not
defined it will expand in [ -n ] which is true. So please, correct all
these damn [ -n $VAR ] into [ -n "$VAR" ] which expands in [ -n "" ]
which is false.

-- 
Xavier

Reply via email to