I am sure I must be doing something wrong, but I can't figure out what. A simple string comparison does not seem to be working. My shell script is as follows:
echo $HOME
echo $1
if [ $# -eq 0 ];
then
echo "No Params!"
elif [ "$1"="prod" ];
then
echo "Production"
else
echo "Incorrect Params"
fi
When I run the script without any params, I get the correct output. i.e. "No Params"
However, when I pass a parameter other than prod, the script still outputs "Production" whereas I expect it to echo "Incorrect Params"
I looked at various places for string comparison within a shell script, e.g. Compare a string in Unix and they seemed to have followed the same approach.
Where am I going wrong?