IF

  • The if command works like in most programming languages.

  • It usually uses the result of the test command and its syntax is:
    
    if [ EXPRESSION ] ; then
    COMMANDS ;
     else 
    COMMANDS2 ;
    fi
    
  • The else part is optional.

  • For example:
     if [ $a = 2 ] ; then
       b="y-axis";
     fi