On 3/6/06, Voytek Eymont <[EMAIL PROTECTED]> wrote: > > On Mon, March 6, 2006 12:34 pm, Martin wrote: > > $quoted_author = "Voytek Eymont" ; > > thanks, all > > how can I take care of strange file names that I might encounter, like, > spaces, commas and stuff, I've tried "" but it still barfs at times: > > --------- > for i in `ls *.jpg` ; do convert -resize 100 "$i" ./thumbs/"$i"; done > ---------- Read "man bash" (insert joke about Cronulla here)
"" still expands a fair amount of special characters - you might get more success with '' (that is, single quotes rather than double). Your biggest problem in this case though is that the default $IFS (input field seperator) is " " - thus, when bash is looping through the output of `ls *.jpg` the filename "Mark, Mad and Oliver.jpg" is split into four tokens - "Mark," "Mad" "and" and "Oliver.jpg" Try this: IFS="\ ";for i in `ls *.jpg` ; do convert -resize 100 "$i" ./thumbs/"$i"; done (yes, that newline after the \ is meant to be there) (nb: this is guaranteed to be roughly on the right track, but I've not tested it, and my recollection of the times I've had to do this suggests that the actual commandline needed is slightly more complex than that) -- There is nothing more worthy of contempt than a man who quotes himself - Zhasper, 2005 -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
