for loop in the shell a tutorial
There are two syntaxes that can be used for a for loop in a linux shell , the first one is more sparse , as in :
for var in words
do
# The program
done
The second one is more terse as in :
for var in words ; do Program ; done ;
Here are some examples to illustrate the two syntaxes :
As with every other program which is run in the shell , the output of the for loop can be redirected to a file , or piped to another program . And the for loop can be run as a background job .