One of the most common things you'll want to do, having devised a data-processing path, is to apply those operations to a series of data files. For this you need a foreach...end construct.
convert # Only need be invoked once per process
foreach file (*.fit)
stats $file
end
This takes all the FITS files in the
current directory and computes the statistics for them using the
stats command from KAPPA. file
is a shell variable. Each time in the
loop file is assigned to the name of the next file of the list
between the parentheses. The * is the familiar
wildcard which
matches any string. Remember when you want to use the shell
variable's value you prefix it with a $. Thus $file is the filename.
C-shell Cookbook