I wrote a script and parts of the script are as follows:
if [ "$1" == "this_script" ] then
elif [ "$1" == "other_script" ] then
echo "missing argument"
syntax error near unexpected token `elif'
`elif [ "$1" == "SWDB" ] then'
You need a semi-colon after
if [ ... ] and before
then, and the same with
if [ "$1" == "this_script" ]; then # ^ # here! # v elif [ "$1" == "other_script" ]; then
The syntax of the if command is:
if test-commands; then consequent-commands; [elif more-test-commands; then more-consequents;] [else alternate-consequents;] fi
test-commandslist is executed, and if its return status is zero, the
consequent-commandslist is executed. If
test-commandsreturns a non-zero status, each
eliflist is executed in turn, and if its exit status is zero, the corresponding
more-consequentsis executed and the command completes. If ‘
else alternate-consequents’ is present, and the final command in the final
elifclause has a non-zero exit status, then
alternate-consequentsis executed. The return status is the exit status of the last command executed, or zero if no condition tested true.