For command

The syntax of the for command is

for variable in word ...

do list

done

The words are expanded, and then list is run repeatedly with variable set to each word in turn. You can replace do and done with braces ({ }).

Examples

  1. A for command to process a list of objects.
    list=$(ls *.class)
    for object in $list
    do
      system "DSPJVAPGM $object"
    done