I have studied a lot of tutorials on bash scripting but I simply cannot get this to work..
Please tell me what I am doing wrong in this simple example:
Code: Select all
#!/bin/sh
a=$1
b="help"
c="fpc"
d="laz"
if [ $a == $b ]
then
echo "Arg1 is equal to $a"
elif [ $a == $c ]
then
echo "Arg1 is equal to $a"
elif [ $a == $d ]
then
echo "Arg1 is equal to $a"
else
echo "None of the condition met"
fi
exit
Code: Select all
./testscript.sh fpc
./testscript.sh: 8: [: fpc: unexpected operator
./testscript.sh: 11: [: fpc: unexpected operator
./testscript.sh: 14: [: fpc: unexpected operator
None of the condition met
I have stared at this for a long time now, not understanding what I am doing wrong...
Must be something simple.