Possible grep(1) bug or user error :)?

Eygene Ryabinkin rea-fbsd at codelabs.ru
Sat Mar 17 22:14:50 UTC 2007


Garret,

Sat, Mar 17, 2007 at 02:47:43PM -0700, Garrett Cooper wrote:
> I was recently grepping a directory and outputting to a file located in the 
> same directory as follows:
> 
> 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).

And what you expected? The file {key}.found was created prior to the
expansion of '*', so grep was parsing that file and feeding it with
the messages about the lines with {key} that were found. And these
lines also provoked grep to add more lines about the {key} found, and
so on. I think you got the idea of the infinite cycle you created.
-- 
Eygene


More information about the freebsd-hackers mailing list