From owner-freebsd-questions@FreeBSD.ORG Tue Jun 16 18:04:57 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BFF85106566B for ; Tue, 16 Jun 2009 18:04:57 +0000 (UTC) (envelope-from mel.flynn+fbsd.questions@mailing.thruhere.net) Received: from mailhub.rachie.is-a-geek.net (rachie.is-a-geek.net [66.230.99.27]) by mx1.freebsd.org (Postfix) with ESMTP id 7BA018FC20 for ; Tue, 16 Jun 2009 18:04:57 +0000 (UTC) (envelope-from mel.flynn+fbsd.questions@mailing.thruhere.net) Received: from smoochies.rachie.is-a-geek.net (mailhub.rachie.is-a-geek.net [192.168.2.11]) by mailhub.rachie.is-a-geek.net (Postfix) with ESMTP id 775117E847; Tue, 16 Jun 2009 10:04:56 -0800 (AKDT) From: Mel Flynn To: freebsd-questions@freebsd.org Date: Tue, 16 Jun 2009 10:04:55 -0800 User-Agent: KMail/1.11.4 (FreeBSD/8.0-CURRENT; KDE/4.2.4; i386; ; ) References: <2620c3260906160636j1f6758fcgafaa6c50811a3452@mail.gmail.com> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200906161004.55935.mel.flynn+fbsd.questions@mailing.thruhere.net> Cc: Carmel NY , Daniel Underwood , Moises Castellanos Subject: Re: Problem with bash script X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Jun 2009 18:04:58 -0000 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