Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Mar 2002 18:27:56 -0800
From:      "Eric Parusel" <lists@globalrelay.net>
To:        "Bsd Neophyte" <bsdneophyte@yahoo.com>, <freebsd-questions@freebsd.org>
Subject:   Re: question about the 'find' command
Message-ID:  <003501c1c57f$b1b96400$5e4e5318@cns>
References:  <20020307020236.7623.qmail@web20110.mail.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> my unix text talks about the 'find' command... it further goes to
talk
> about an "action" used with the find command.
>
> I am completely confused as to what the {} do with the find comand.
>
> the explanation is this: "A set of braces, {}, delimits where the
file
> name is passed to the command from the prceding expressions."
>
> Now what does this mean?  It makes no sense to me.
>
> an example they give is the following:
>
> $ find ~ -name core -exec rm {} \;

This will result in find finding, for example:

./dira/core
./otherdir/core
./anotherdir/core

For each file found, "rm" will be run, with the name & path of the
file found being an argument (that's what the {} is for)....
So find will run:

rm ./dira/core
rm ./otherdir/core
rm ./anotherdir/core

So before you run something like this you'll want to leave off the
"-exec {} \;:" arguments, and see what files you're about to delete :)

You might want to try "man find" also.
If you're not sure about a command, read the man pages, they're really
useful!

Later,

Eric



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?003501c1c57f$b1b96400$5e4e5318>