[Top][All Lists]

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

bug#19998: GREP_OPTIONS alternative?

From: Christian Kujau
Subject: bug#19998: GREP_OPTIONS alternative?
Date: Wed, 11 Mar 2015 14:11:58 -0700 (PDT)
User-agent: Alpine 2.19.4 (DEB 40 2013-11-18)

On Wed, 11 Mar 2015 at 11:15, Paul Eggert wrote:
> On 03/05/2015 11:24 AM, Christian Kujau wrote:
> > that (and the bits below) seem to confirm that there's no simple
> > alternative to GREP_OPTIONS
> I don't see why the script solution is not considered 'simple'.

Hm, I don't understand how the script solution _can_ be considered 
'simple', but maybe I haven't made it clear enough. With GREP_OPTIONS, one 
only had to put a single line in .profile, which was honored by all the 
GNU grep variants that supported GREP_OPTIONS.

   export GREP_OPTIONS="...."

Without GREP_OPTIONS, one has to

1) Write a script for each grep variant (fgrep, zgrep, egrep, etc.)
2) put $HOME/bin in $PATH

I'd consider this much more complicated, especially 1) - either write a 
script for eeach variant or write a single script that pays attention on 
how it's called and put symlinks in $HOME/bin.

Also: on systems that do _not_ support these options, I cannot use this 
setup. To elaborate on this a bit more: I usually have a fairly static set 
of .dotfiles that I'd like to install in $HOME on a new machine. For 
instance, I'd set HISTTIMEFORMAT which is honored by newer versions of
'bash' but maybe the system does not have a bash installed and then this
variable is just ignored, no harm done. Same with GREP_OPTIONS - if 
GNU/grep was installed, the variable would be honored, other grep
implementations might choose to ignore it. If $HOME/bin/grep is really 
"grep --devices=skip", a the Solaris version of grep would bail with
"unrecognized option".

Of course, I understand the flip side of the coin: if GREP_OPTIONS gets 
set, maybe even system wide, shell scripts may behave differently. But 
that's true for every environment variable. If PATH omits /bin:/usr/bin, 
scripts maye behave very differently. Same for LC_ALL or or something 
else. Even GNU/tar has TAR_OPTIONS, so I don't really understand why 
GREP_OPTIONS is being dropped, just because some script broke because it 
didn't pay attention to environment variables.

> Anyway, it's
> worth documenting the script alternative, so I installed the attached into the
> manual and am marking the bug as done.

I didn't even expect that a mail the mailing list would open a formal bug 
report :-)

BOFH excuse #277:

Your Flux Capacitor has gone bad.

reply via email to

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