While attempting to extract a single argument given from a bash script I am getting an error:
./intercept.sh: line 23: [run: command not found
./intercept.sh: line 28: [run: command not found
USAGE: ./intercept.sh run|term
How I'm processing the argument provided:
function main () {
if [$1 == 'run']
then
echo "turning intercept proxies on";
# enableInterceptProxies;
echo "intercept proxies turned on";
elif [$1 == 'term']
then
echo "turning intercept proxies off";
# disabbleInterceptProxies;
echo "intercept proxies turned off";
else
usage;
fi
}
main $@;
What am I doing wrong here? All I need to do is check if the single argument is run
or term
, how can I do this successfully?