Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Jun 2009 10:04:55 -0800
From:      Mel Flynn <mel.flynn+fbsd.questions@mailing.thruhere.net>
To:        freebsd-questions@freebsd.org
Cc:        Carmel NY <carmel_ny@hotmail.com>, Daniel Underwood <djuatdelta@gmail.com>, Moises Castellanos <m2o7i1@gmail.com>
Subject:   Re: Problem with bash script
Message-ID:  <200906161004.55935.mel.flynn%2Bfbsd.questions@mailing.thruhere.net>
In-Reply-To: <b6c05a470906160703m5f2fe4a5s955e7bf044b26a69@mail.gmail.com>
References:  <BLU0-SMTP586D9F12148D0B6683B635933F0@phx.gbl> <2620c3260906160636j1f6758fcgafaa6c50811a3452@mail.gmail.com> <b6c05a470906160703m5f2fe4a5s955e7bf044b26a69@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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.
-- 
Mel



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906161004.55935.mel.flynn%2Bfbsd.questions>