if greater than


X=87;

if [ $X -gt 100 ]; then
   # do something if contrition is true
elif [ $X -lt 200 ]; then
   # do something if second condition is also true
else
   # do something if all conditions are false
fi


Conditions
   x -eq y   True if the integers x and y are algebraically equal
   x -ne y   True if the integers x and y are not algebraically equal
   x -gt y   True if the integer x is algebraically greater than the integer y
   x -ge y   True if the integer x is algebraically greater than or equal to the integer y
   x -lt y   True if the integer x is algebraically less than the integer y
   x -le y   True if the integer x is algebraically less than or equal to the integer y
   s1        True if s1 is not the null string
   s1 = s2   True if strings s1 and s2 are identical
   s1 != s2  True if strings s1 and s2 are not identical

Multiple conditions - AND - OR

# AND: test if X is between 100 and 200
if [ $X -gt 100 ] && [ $X -lt 200 ]; then
  echo "X is between 100 and 200";
fi

# OR: test if X is equal to 100 or equal to 200
if [ $X -eq 100 ] || [ $X -eq 200 ]; then
  echo "X is exact 100 or exact 200";
fi



General

if condition ; then
    commands
fi

if condition ; then
    commands
else
    commands
fi

if condition1 ; then
    commands
elif condition2 ; then
    commands
else
    commands
fi