The for statement

The for loop notation has the general form:

   for var in list-of-words
   do
     commands
   done

commands is a sequence of one or more commands separated by a newline or ; (semicolon).

The reserved words do and done must be preceded by a newline or ; (semicolon). Small loops can be written on a single line. For example:

   for var in list; do commands; done

[Home] [Search] [Index] This site maintained by guichard@whitman.edu