On Saturday 29 May 2010 17:05:34 Daniel D Jones wrote:
> On Wednesday 26 May 2010 06:42:08 Joerg Schilling wrote:
> > Patrick Holthaus <patrick.holth...@uni-bielefeld.de> wrote:
> > > You might try:
> > > 
> > > find -name *.ext -print0 | xargs -0 rm
> > 
> > But this is non-standard.
> 
> In what way is this non-standard?  That is, what standard is it contrary
> to? TMTOWTDI (There's More Than One Way To Do It) applies just as strongly
> to *nix in general as it does to Perl.  When there are multiple ways to do
> something, it's often either a user preference issue or the method should
> be decided based upon the particular details of the desired result.  -exec
> may be a POSIX standard function, but that doesn't mean it must be used
> over other options or you're breaking the standard.
> 
> > UNIX introduced -exec {} + 1990 (when David Korn rewrote find(1)
> > and it is in the POSIX standared since some time.
> 
> -exec (which potentially has problems with race conditions - -execdir
> should almost always be used instead) runs the command once for each file
> found. xargs will call the command once for as many files as it can fit on
> the command line.  For some instances, like rm, that probably isn't
> significant.  But if you're calling a complex process with lots of files,
> the overhead of starting the many extra processes may be significant.

Perhaps you don't know Joerg yet. When dealing with the man, it's important to 
know where he's coming from - and that is not "how Linux does stuff"

He invariably refers to POSIX when mentioning standards. He uses this standard 
to ensure that his code will work on any *nix platform. This puts him at odds 
with the Linux crowd sometimes - two very different viewpoints.

It's not "-exec" that causes one processto be launched per item found, it is 
"-exec \;"

He referred to "-exec +" which has the same behaviour as you mention - use as 
many filenames as will fit on the command line.


-- 
alan dot mckinnon at gmail dot com

Reply via email to