In article <20101110113444.ge...@apb-laptoy.apb.alt.za>, Alan Barrett <a...@cequrux.com> wrote: >On Wed, 10 Nov 2010, Christoph Badura wrote: >> On Tue, Nov 09, 2010 at 08:34:56PM +0000, Alan Barrett wrote: >> > Modified Files: >> > src/usr.bin/pathchk: pathchk.1 >> > >> > Log Message: >> > Change the ironically unafe "find . -print | xargs pathchk -p" to >> > the safe "find . -exec pathchk -p \{\} +" in an example. >> >> Why not save all the forks and use "find . -print0 | xargs -0 pathchk -p"? > >The reason I didn't use "-print0" or "xargs -0" is that both those >features are extensions to POSIX, whereas "-exec ... +" in standardised. > >"-exec ... +" and "xargs" will both accumulate many args into each >invocation of the child program, and will both fork the same number of >times. The version using xargs is actually less efficient, because >there's one extra fork to run "xargs" itself, and there's extra I/O over >the pipeline. > >Christos seems to have made the same mistake as you, confusing "-exec >... \;" (which runs a separate child program for each file name) with >"-exec ... +" (which passes many file names to each invocation of the >child program).
Yes, I did not know about exec {} + christos