Re: encapulating a find function in a script

Mike Castle <[email protected]> Wed, 14 Jan 2004 17:00:47 -0800
Newsgroups org.kernel.vger.linux-console
Message-ID <[email protected]>
On Wed, Jan 14, 2004 at 04:34:01PM -0800, [email protected] wrote:
> Try putting double-quotes around the parameters, like:
> 
> 	 find $1 -name "$2" -exec grep -H "$3" '{}' ';'
> 
> This works for me in a similar script, at least in the csh shell.

You may also find that using xargs instead of -exec is much faster (fewer
fork/execs).

Something like:

find "$1" -name "$2" -print0 | xargs -0 grep -H "$3"

mrc
-- 
     Mike Castle      [email protected]      www.netcom.com/~dalgoda/
    We are all of us living in the shadow of Manhattan.  -- Watchmen
fatal ("You are in a maze of twisty compiler features, all different"); -- gcc