WHILE

  • The while command executes a set of commands as long as the condition is true.
  • Syntax:
    while CONDITION ; do
        COMMANDS ;
    done

  • The condition is usually a test statement.

  • Example:
    a=1
    while [ $a -lt 4 ] ; do
        bet im$a brain$a ;
        a=`echo $a + 1 | bc` ;
    done