I am facing the syntax error near unexpected token,elif error for the following code.
if [ "$1" == "abc" ]; then
echo "abc"
elif [ "$1" == "xyz" ]; then
echo "xyz"
else
echo "Unkown parameter"
exit 0
fi
Error is:
abc.sh: line 28: syntax error near unexpected token elif'
abc.sh: line 28:elif [ "$1" == "xyz" ]; then
=instead of==help? (POSIX specifies=bash/etc. allow==for compatibility though.) If not then this code snippet is valid and the error lies somewhere else and/or in something that didn't paste cleanly (DOS line endings, odd non-printing characters, etc.).