I'm new to linux (using Ubuntu 10.10) and I'd like to add a function to .bashrc that starts/stops a tomcat server. I'm trying to parse two options for the command "tomcat". I've tried the following in various permutations, but none of them work.
export CATALINA_HOME=/tomcat/directory
function tomcat {
if [$1 = "-s" ]; then
`sh $CATALINA_HOME/bin/startup.sh`
elif [$1 = "-x"]; then
`sh $CATALINA_HOME/bin/shutdown.sh`
else
echo "Enter '-s' to start Tomcat, '-x' to shutdown."
fi
}
Why doesn't this work? What's the right way to do it?
Thanks!