On Saturday 29 May 2010 14:59:16 Alan McKinnon wrote: > On Saturday 29 May 2010 17:05:34 Daniel D Jones wrote: ... > > -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.
I wasn't coming from a Linux perspective. I'm a network engineer. At work, I touch SSH servers running SunOS, file servers running BSD (don't recall what flavor off the top of my head - I'm not in them that often), terminals running HPUX and run Linux at home. xargs is available on all of them. > 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. You're correct, of course. I missed that in the man pages. Mea culpa. (I'm a network engineer, not a sysadmin.) -- "If "everybody knows" such-and-such, then it ain't so, by at least ten thousand to one." - Robert A. Heinlein