[Next] [Previous] [Up] [Top] [Contents]

9.9.3 for and foreach

9.9.3.2 Csh

foreach variable (list_of_values)

command list

end

The equivalent C shell script to copy all files ending in .old to .new is:

#!/bin/csh -f

foreach file (*.old)

set newf = `basename $file .old`

cp $file $newf.new

end


Introduction to Unix - 14 AUG 1996
[Next] [Previous] [Up] [Top] [Contents]