Martin McCormick: > > ls *.[Zz][Ii][Pp] Note that 'ls' doesn't see this pattern at all. The pattern is expanded by the shell to all existing files matching the pattern. This list of files is then passed to ls. Using 'echo' would yield (almost) the same result in this case.
> for MAGFILE in `ls *.[Zz][Ii][Pp] $MAGDIR/`; do > #lots of other stuff > done I think you meant to write for MAGFILE in `ls $MAGDIR/*.[Zz][Ii][Pp]` instead. What is happening with your version is the following: - the shell tries to find files matching your pattern in the current directory - since there is no file matching your pattern, it leaves the pattern unchanged - $MAGDIR is expanded - the unexpanded pattern and the content of $MAGDIR are passes to 'ls' - 'ls' prints an error message for your pattern and lists the content of $MAGDIR Another hint: you don't need 'ls' for your case at all. 'ls' without any parameter just prints out the names of the files that have been passed to it by the shell. You can get away without the command substitution: for MAGFILE in $MAGDIR/*.[Zz][Ii][Pp] # … done J. -- Watching television is more hip than actually speaking to anyone. [Agree] [Disagree] <http://www.slowlydownward.com/NODATA/data_enter2.html>
signature.asc
Description: Digital signature