bug-gnu-utils
[Top][All Lists]
Advanced

[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: Thu, 10 Jun 2004 16:41:19 +0200
User-agent: Mutt/1.4.1i

Hello,

On Thu, Jun 10, 2004 at 03:59:06PM +0200, Koblinger Egmont wrote:
> So my feature request is: if "-r" or an equivalent option is given to
> grep, and the file argument is omitted, it should default to "." rather
> than stdin.

thank you for submitting your feature request.  I have myself thought
about the feature, as I have similar experience.  You may find some
discussions in the archive of this list in lists.gnu.org.

The decision was against the feature, the main problem being this:

-r is equivalent to --directories=recurse . There are three possible ways
to cope with directories, `read' is hardcoded by default, but each user
can change the default by adding this option to the GREP_OPTIONS
environment variable.  Many users prefer `skip', some might even go
for `recurse'.

The quiestion is when should be the default `stdin' changed to `.'.

When GREP_OPTIONS contains --directories=recurse, the default should still
be `stdin', when grep is called as `grep -r', the default should be `.'.
But where should the border lie?  Should we decide according to where was
`-r' specified?  Or according to which form was used (-r, -drecurse, or
--directories=recurse)?

Thus I believe the best solution is to leave the default as is.

If you really think this is a problem, you can define a wrapper, via
a shell function or shell script.  Many people have alias rm="rm -i"
in their profile, and I believe this is a similar situation.

Sorry that I don't have better news for you,
        Stepan Kasal




reply via email to

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