FOR

  • The for command executes a set of commands for every word in a list of words.
  • Syntax:
    for VARIABLE in LIST OF VALUES ; do
        COMMANDS ;
    done

  • The commands are executed once for each entry in the words list.
  • Each time the variable specified is equal to the current word.

  • Example:
    for filename in im1 im2 im3 ; do
        bet $filename ${filename}_brain ;
    done