for file in prog1 prog2 prog3 do ...process $file done
I wanted a for loop that stores several different shell variables and makes one pass through the loop for each set of variables (instead of one pass for each item , as a regular for loop does). This loop does the job:
If you have any command-line arguments and still need them, store them in another variable before you do that. Or, you can make the loop this way:
for bunch in "u=ellie f=file16 s='your files'" \ "u=donna f=file23 s='a memo'" "u=steve f=file34 s=report" do # SET $u (USER), $f (FILENAME), $s (SUBJECT): eval $bunch mail -s "$s" $u < $f done
This script uses the shell's
command to re-scan the contents of the
variable and store it in separate variables.
Notice the single quotes like