On 28.07.2010 14:42, Jochen Schulz wrote:
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.
[...]
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
It's actually the prefered way (quoting "$MAGDIR" would also be
encouraged). Otherwise word splitting occurs on the list (files and
directories with spaces in their names will fail).
set +f is also required, which is the default, but sometimes turned off
in non-interactive shells.
Best regards
Mart
--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/4c504af3.1070...@chello.at