[csh, bash] reading txt line by line

I use this script for handling netcdf with reading file name from *.txt line by line.

——————————————-

<For csh>

ls -1 *.nc > list.txt

foreach file ( “`cat list.txt”)

echo $file

end

——————————————

<For bash> ref, ref2

ls -1 > list.txt

while read line

do

echo “$line”

done < list.txt

——————————————-

So, Simple, even powerful 🙂