#! /bin/csh -f # # Filename: foreach3 # # Reference: UNIX C Shell Desk Reference by Martin R. Arick # # This program gives a long listing of the files in the various # directories under the current directory. It does not process # directories within directories, etc. # foreach entry (*) if (-d $entry) then # this is a directory pushd $entry >& /dev/null # change to this directory echo "------------------------------------------------------" echo "--- Contents of $cwd directory follows ---" ls -l popd >& /dev/null # return to the original directory endif end echo "--- End of listing ---"