I could have sworn I have done this before but obviously
not because I can't get it to work no matter what I try.
I am running a shell script that is supposed to find
every .zip or .ZIP file in a directory and do an extraction of
the contents. I don't want any other files to be included in the
script as they are not zip files. What works exactly from the
command line is:
ls *.[Zz][Ii][Pp]
I get any .zip or .ZIP file that is in the directory. In the
script, there is some code as follows:
for MAGFILE in `ls *.[Zz][Ii][Pp] $MAGDIR/`; do
#lots of other stuff
done
I think I have tried about every form of escaping there
is and the error is that *.[Zz][Ii][Pp] is no such file or
directory.
If I leave out the attempted regular expression of
*.[Zz][Ii][Pp], the loop works but then any other non-zip or
non-ZIP files get processed.
Many thanks for any suggestions or explanations as to
why this does not seem to work.
Martin McCormick