Why repeat a command multiple times when UNIX can do it for you

Foreach var (argv1 argv2 ...)
foreach? do something $var
foreach? end

The command takes each argument in the brackets ( ) in turn and replace the in the commands defined at the variable $var.
eg.
Foreach fred (usr tmp)
foreach? ls /$fred
foreach? end

This will list the contents of /usr and /tmp.

_______________


This is useful in itself but get better if you call a command with ` ` 
NB: " ` " is on the same key as the "¬" character on the keyboard  

eg.
Foreach myuser (`cat /tmp/myuserlist`)
foreach? grep $myuser /etc/passwd
foreach? end |
This will search the passwd file for a users listed in a file /tmp/myuserlist.

Home --> Unix --> Foreach

Foreach