Problem with bash script

Mel Flynn mel.flynn+fbsd.questions at
Tue Jun 16 18:04:58 UTC 2009

On Tuesday 16 June 2009 06:03:33 Daniel Underwood wrote:
> > $  find ./ -name "*.pem" -exec cp {} /usr/home/tmp/something \;
> I'm a novice with shell scripting myself, but what's the difference
> between that code and some variant thereof using a pipe and "xargs"?
> Are they simply two different ways of achieving the same result?  Or
> is there some more important difference I may be overlooking?

Moises' way is less efficient as it will copy each file separately, however, 
if he ends with a + rather then a \;, then using exec is marginally faster as 
you eliminate 1 pipe from the tool chain.

See find(1) for more info.

More information about the freebsd-questions mailing list