->Title Page
-->File Structure
-->Online Manual
-->Basic Commands
-->Additional Commands
-->Login files
-->Special characters
-->Miscellaneous Tips
--->Strange names
--->Advanced wildcards
--->Terminal input
--->Remote shell
->Loops in scripts
--->More tricks
-->Things to try
->Vi editor
->Mirror sites
->Further reading

[ Up ]

Unix ---> Loops in scripts

Here is an example of a simple loop in a script. I use it to send out my biweekly junkmail messages.1

    for i in `cat $HOME/jm/list`
      mail -s 'Junkmail message number '$1 $i < jm.$1
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.

Site Statistics

1 I no longer find the time to continue this. However, I do have a collection of amusing things my professors said while I was in grad school available on my website. (These quotes were a component of my junkmail messages.)

t a y l o r@l i n u x b o x.c o m

© 1993-1998 Christopher C. Taylor