Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Mar 2002 08:32:40 +0100
From:      F.Xavier Noria <fxn@retemail.es>
To:        Bsd Neophyte <bsdneophyte@yahoo.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: question about the 'find' command
Message-ID:  <20020307083240.2eaec696.fxn@retemail.es>
In-Reply-To: <20020307020236.7623.qmail@web20110.mail.yahoo.com>
References:  <20020307020236.7623.qmail@web20110.mail.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 6 Mar 2002 18:02:36 -0800 (PST)
Bsd Neophyte <bsdneophyte@yahoo.com> wrote:

: an example they give is the following:
: 
: $ find ~ -name core -exec rm {} \;

Besides the other answers, I would like to add that while that use of
-exec is popular, it is doing the job as a side effect, since we discard
the boolean value resulting from the execution of "rm".  I mean, "find"
provides boolean operators to filter its ouput, -name, -or, -newer, and
-exec are examples.  The unary -exec returns a boolean value according
to the exit status of the executed command.

That's why when I want to do something with the filenames resulting from
running "find", I prefer to pass them to the actual command like this:

    $ find ~ -name core | xargs rm

Just my philosophical 2 cents.

-- fn


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020307083240.2eaec696.fxn>