|
For Loop Question
Hi, I am writing a bash shell script. I will have a section of code devoted to a for loop:
for FILE in *.hdf *.L2; do
echo hello world
done
The complication is that sometimes there will not be any files with a ".hdf" extension, or sometimes there won't be any with a ".L2" extension. Since there are files with other extensions I can't just say "for FILE in *; do". How can I make my script loop through a number of times equal to the amount of files ending in .hdf or .L2, but not care if sometimes either of those filetypes doesn't exist?
Mike
|