Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 17 Mar 2007 16:09:23 -0700
From:      Garrett Cooper <youshi10@u.washington.edu>
To:        freebsd-hackers@freebsd.org
Subject:   Re: Possible grep(1) bug or user error :)?
Message-ID:  <45FC7523.9050100@u.washington.edu>
In-Reply-To: <45FC69D5.3010406@mammothcheese.ca>
References:  <45FC61FF.3090009@u.washington.edu> <45FC69D5.3010406@mammothcheese.ca>

next in thread | previous in thread | raw e-mail | index | archive | help
James Bailie wrote:
> Garrett Cooper wrote:
>  > grep -ri {key} * > {key}.found
>  >
>  > The thing is that grep kept on feeding off of the {key}.found file and
>  > eventually ate up all the free space on the device (~12GB).
> 
> The shell is redirecting stdout onto the found file before it is
> expanding the glob patterns, so the found file is being included
> in the expansion.  You can force the expansion to occur first if
> you assign it to a variable:
> 
> sh:
> 
> FILES=*; grep -ri key $FILES > found
> 
> csh:
> 
> set FILES=*; grep -ri key $FILES > found
> 
> Hope this helps,

Thanks James :). That's another good solution for working around that.

-Garrett




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?45FC7523.9050100>