shell scripting style question

Jason Stephenson jason at sigio.com
Thu Dec 5 09:30:40 EST 2002


There are several differences. I'd actually do the following:

find /yourdir -iname *.bmp -exec convert {} {}.jpg \;

Of course, if all the images are in a single subdirectory then a for 
loop would be better because you can do more variable substitution inside.

Something like this:

for file in /dir/*.bmp /dir/*.BMP
do
bname=${file%.}
convert ${file} ${bname}.jpg
done

That's in a sh-oriented syntax. Switching to csh is pretty simple.

Price, Erik wrote:
> 
>>-----Original Message-----
>>From: Kevin D. Clark [mailto:kclark at cetaceannetworks.com]
>>Sent: Wednesday, December 04, 2002 5:31 PM
>>To: Charles Farinella
>>Cc: gnhlug-discuss at mail.gnhlug.org
>>Subject: Re: convert large number of graphics
>>
> 
>  [...]
> 
>>
>>for A in `find /yourdir \( -name \*.bmp -o -name \*.BMP \) 
>>-print` ; do
>>  bmptoppm $A | ppmtojpeg >`echo $A | sed 's/\.bmp/.jpg/i'`
>>done
> 
> 
> Just out of curiosity, is the only difference between using
> "find" and "ls -R" (in this particular case) that you can
> use more than one glob argument?
> 
> 
> Erik
> _______________________________________________
> gnhlug-discuss mailing list
> gnhlug-discuss at mail.gnhlug.org
> http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss
> 




More information about the gnhlug-discuss mailing list