lundi 23 mai 2016

elif statement in bash for if-then-else

I am rather new to bash scripting and I wonder why the following doesn't work as expected?

10 #check to see if X > Y or not
 11 read X
 12 read Y
 13 
 14 if [[ X -lt Y ]]; then
 15   echo "X is less than Y"
 16 else if [[ X -gt Y ]]; then
 17   echo "X is greater than Y"
 18 else
 19   echo "X is equal to Y"
 20 fi

Aucun commentaire:

Enregistrer un commentaire