[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: grep: default file if -r is used

From: Stepan Kasal
Subject: Re: grep: default file if -r is used
Date: Fri, 11 Jun 2004 08:40:33 +0200
User-agent: Mutt/1.4.1i


On Thu, Jun 10, 2004 at 10:04:45PM -0400, Paul Jarc wrote:
> Couldn't that break existing code?  If GREP_OPTIONS=-r happens to be
> set in the environment when a script runs "whatever | grep pattern",
> grep should still read stdin.

in other words:
If someone talls me that they want ``grep pat dirname'' to go recursively
through the tree, I suggest him to set ``GREP_OPTIONS=-drecurse''.

Is it insane that they require that
        foo | grep pat
still works?

Of course, one can imagine that we add a fouth possibility besides
`read', `skip' and `recurse':

--directories=recurdir  ... recurse directories; additionally when
        no filename is given, search current directory

and make `-r' shortcut for this.

Then ``grep -r pat'' would search current dir.

And we would have to teach people to use GREP_OPTIONS=-drecurse
insted of GREP_OPTIONS=-r .

But I beleive this solution would be too complicated to be worth it.

Stepan Kasal

reply via email to

[Prev in Thread] Current Thread [Next in Thread]