I'm learning shell scripting but I can't work out this error, any help much appreciated.
#!/bin/sh
LOCATION=/tmp/loc
PROXY=http://wwwproxy.unimelb.edu.au:8000
http_proxy=$PROXY; export http_proxy
echo "Installing into" $LOCATION
if [ ! -d $LOCATION ]; then mkdir $LOCATION; fi
if [ ! -d $LOCATION/packages ]; then mkdir $LOCATION/packages; fi
TOMCAT_FILE=apache-tomcat-6.0.24.tar.gz
if [ ! -e $LOCATION/packages/$TOMCAT_FILE ]; then
echo "Downloading" $TOMCAT_FILE
wget http://mirror.olnevhost.net/pub/apache/tomcat/tomcat-6/v6.0.24/bin/apache-tomcat-6.0.24.tar.gz -O $LOCATION/packages/$TOMCAT_FILE
else
echo "Found" $TOMCAT_FILE
fi
It appears to be failing on the third if statement with the error:
bash-3.00$ ./install.sh
Installing into /tmp/loc
./install.sh: test: argument expected
(And for those who think they know better how to do this, no I really do have to write a script to take care of this due to external requirements)