Re: Simple way to script thumbnails

Stan Bischof <stan@xxxxxxxxxxxxxxxxxx> wrote:
Chris F.A. Johnson <cfajohnson@xxxxxxxxx> wrote:
for j in `ls -tr *.${i} `

Not only is ls unnecessary, but it will break your script if any
filenames contain whitespace or other pathological characters. Use
parameter expansion directly:

for j in *".$i"

thanks for the style hints and whatnot- but this one is
an issue. Due to the way that the pictures are assembled it
becomes important that they show up in temporal order
and not necessarily name order. hence the ls -tr

*".$i" would not add them in temporal order.

And-- after thinking about this a little, this change
would actually break my script . In particular, if
files do not exists with a given suffix from my list then
ls returns nothing so no action is taken. *".$i"
returns *".$i" expanded, so a bogus action is taken.

For instance if there's no JPG suffix files then
I end up with an HTML line referencing *JPG

but defnitely thanks for the suggestions. Hadn't seen that
particular variable expansion, but it seems quite nice.