Here is an example of a simple loop in a script. I use it to send out my biweekly junkmail messages.[+]
#!/bin/sh
for i in `cat $HOME/jm/list`
do
mail -s 'Junkmail message number '$1 $i < jm.$1
done
The script takes one line at a time from the file $HOME/jm/list
and executes the command
mail -s 'Junkmail message number '$1 $i < jm.$1
where $1 the first argument on the command line calling the script
and $i is the line from the file $HOME/jm/list.