Lars Gullik Bjønnes wrote:
> Angus Leeming writes:
> | find foo -name '*.gif' | while read file
> | do
> |     pngfile=`basename "$file" .gif`.png
> |     convert "$file" "pngfile"
> | done

> Hmm... I thought thiw was usually written as a for-loop.
> for file in `find foo -name \*.gif` ; do
>         pngfile=`basename "$file" .gif`.png
>         convert "$file" "$pngfile"
> done

Won't work when the returned files have spaces in their names. Try out my
prescription in the mail you're replying to :)

The problem is that "for" splits the returned list of files using
whitespace...

Perhaps the bigger problem is that you can overrun the internal array size
used by "for" to store the list of returned list of files.

google on "useless use of cat" or just go here:
http://www.ruhr.de/home/smallo/award.html and read the "dangerous
backticks" section.

> (and you forgot a '$')

Right :) (And restricted the search to the foo directory rather than the
original .)

-- 
Angus

Reply via email to