On Sat, Dec 07, 2002 at 08:26:21PM +0100, Frank Gevaerts wrote:
> >   find . -name '*.jpg' -print0 | xargs -r0 mpg123
> 
> Any special reason not to use -exec (except of course that xargs works
> with any input, while -exec only with find (obviously))

I always use xargs instead of find -exec because it just comes more
naturally to me. There are some technical reasons for it, though.

GNU xargs is considerably more versatile than -exec. On some platforms
(not sure about GNU find/xargs) find also spawns a subshell for every
file with -exec, which makes xargs considerably more efficient. Not much
difference for a dozen files, but if you have a few thousand results
you're saving the time of starting a few thousand shells that do nothing
but run a single command and exit.

-- 
Michael Heironimus


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to