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: Koblinger Egmont
Subject: Re: grep: default file if -r is used
Date: Fri, 11 Jun 2004 10:09:43 +0200 (CEST)

On Fri, 11 Jun 2004, Stepan Kasal wrote:

> Sure, it's easy to _code_ it.  I meant it's not worth the fuss of having
> long, complicated manual

Manual would grow about 2%, maybe 5. Who cares?

> and of breaking backward compatibility of
> GREP_OPTIONS=-r

And what if I add a new option, not breaking any compatibility?

Actually, currently '-r' and '-R' are the same, but as I see most people
use '-r'. What if '-r' remains the same and '-R' has the new behaviour?

Just a side note about compatibility, not really related to grep:

Recently I found that "head -1" and friends began not to work, even though
I didn't upgrade coreutils. I had only upgraded glibc a few weeks ago and
then later I recompiled coreutils with the new glibc headers which caused
the change. It's okay that "head -1" hasn't been documented for years, but
in the mean time no runtime warning was issued to give people time to fix
their old scripts, it just suddenly didn't work. (Background story: we're
building a hungarian linux distribution, compiling approx. 1000 source
packages...) We patched coreutils to emit a warning only, but there are I
guess 30, 40, maybe 50 packages which would not compile or not run
properly as they use "tail -1" or "sort +4" etc somewhere.

GNU Grep introduced the '-r' option in about 1999 or 2000. In about 2002 a
friend of mine looked strange to me when I installed the jed text editor
just to use the 'rgrep' utility of this package -- hey, grep can also do
it! Yes, I remember the time when grep couldn't recurse, it wasn't so
long ago. I don't know how much it is POSIX or any other standard, or just
a GNU feature. I don't know if it works or other unices... But somehow I
have a feeling that changing the behaviour or '-R' would really only hurt
an extremely small amount of people, and they could adopt to the change in
a few minutes. (IMHO wasting two letters to the very same one-letter
option wasn't a good idea anyway.)

But, as stated above, I'm even friend of a solution which doesn't break
compatibility at all.

(You'll hate this one but I ask: maybe '-r' would default to '.' only if
stdin happens to be a terminal... this way old scripts keep on working...
Okay, forget it if you don't like it, it _is_ ugly.)


-- 
Egmont




reply via email to

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