shell scripting style question
Kevin D. Clark
kclark at CetaceanNetworks.com
Thu Dec 5 08:29:18 EST 2002
"Price, Erik" <eprice at ptc.com> writes:
>> -----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?
Well, go to the top of a directory tree and type:
find . -print
and compare this with
ls -R . | cat
(or "ls -1R" -- ls outputs differently if it believes that it isn't
connected to a tty)
The output is different. One happens to be easier to work with, IMHO.
"find" happens to be one of my favorite tools.
--kevin
--
``I also suggest that UNIX offers something else prized in literature: a
coherence, a consistent style, something writers call a voice.''
-- Thomas Scoville, ``The Elements of Style: Unix As Literature'',
Unix Review's Performance Computing, September 1998
More information about the gnhlug-discuss
mailing list