GNU bug report logs -
#19998
GREP_OPTIONS alternative?
Previous Next
Full log
View this message in rfc822 format
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 :-)
Christian.
--
BOFH excuse #277:
Your Flux Capacitor has gone bad.
This bug report was last modified 10 years and 134 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.