find -print0 (was Re: svn commit: trunk/busybox )

Rich Felker dalias at aerifal.cx
Fri May 12 01:01:16 UTC 2006


On Thu, May 11, 2006 at 06:50:47PM -0400, Paul Fox wrote:
>  > > > i suppose there are alternate solutions, but find's -print0 and
>  > > > xargs' -0 handle it trivially.  if you have another technique
>  > > > that works well, i'd be interested in learning it.
>  > > 
>  > > I've never used xargs because find has a perfectly good -exec argument
>  > > that does exactly the same thing...
>  > 
>  > "exactly" is not a good word to use there.  There are differences,
>  > both in usage and performance.  -print0 | xargs -0 is better suited
>  > to grep, for instance, that has a relatively heavy startup cost
>  > per process.
> 
> exactly.  the performance hit of running a new process for every
> filename rather than one per MAXARGS filenames is huge, in my
> experience.

oh, forgive me for not understanding what xargs does. so basically
it's a replacement for backticks without the limit on command line
length? if so, i suppose a version with newline separators can still
be done in shell script..

rich




More information about the busybox mailing list