Date: Sun, 14 Aug 2005 01:13:09 +1000 (EST) From: Ian Smith <smithi@nimnet.asn.au> To: Giorgos Keramidas <keramida@ceid.upatras.gr> Cc: Benson Wong <tummytech@gmail.com>, Xu Qiang <Qiang.Xu@fujixerox.com>, freebsd-questions@freebsd.org Subject: Re: Help on bash script? Message-ID: <Pine.BSF.3.96.1050814005813.4423B-100000@gaia.nimnet.asn.au> In-Reply-To: <20050813031912.GB1938@gothmog.gr>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 13 Aug 2005, Giorgos Keramidas wrote: > On 2005-08-12 13:38, Benson Wong <tummytech@gmail.com> wrote: > > I prefer: > > > > for COREFILE in `find / -type f -name core -print` > > do > > ... > > done > > > > Wouldn't that accomplish the same thing? > > More or less. Less, when the filenames are too many. See questions > posted on this very same list about ``too many arguments''. True. Of course if you've got that many core files lying around, you probably have other things to worry about :) > The ``while read line; do stuff with $line; done'' loop doesn't suffer > from the same limitation, but is a bit more expensive in terms of the > number of spawned processes and (consequently) the time it takes to run. Maybe measurable. Took me ages to appreciate the difference between say cat tempfile | while read line; do stuff with $line; done and while read line; do stuff with $line; done < tempfile when 'stuff' needs to update script-scope variables, despite a slightly icky, impure feeling about using tempfiles .. cheers, Ian
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.1050814005813.4423B-100000>