GNU bug report logs - #19998
GREP_OPTIONS alternative?

Previous Next

Package: grep;

Reported by: Christian Kujau <lists <at> nerdbynature.de>

Date: Wed, 4 Mar 2015 07:09:02 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Norihiro Tanaka <noritnk <at> kcn.ne.jp>
To: Christian Kujau <lists <at> nerdbynature.de>
Cc: 19998 <at> debbugs.gnu.org, Paul Eggert <eggert <at> cs.ucla.edu>
Subject: bug#19998: GREP_OPTIONS alternative?
Date: Fri, 06 Mar 2015 00:29:25 +0900
On Wed, 4 Mar 2015 17:04:06 -0800 (PST)
Christian Kujau <lists <at> nerdbynature.de> wrote:

> On Wed, 4 Mar 2015 at 14:43, Paul Eggert wrote:
> > You can put a script like this in $HOME/bin:
> > 
> > #! /bin/sh
> > export PATH=/usr/bin
> > exec grep --color=auto --devices=skip "$@"
> > 
> > and then prepend $HOME/bin to your PATH.
> 
> Well, and I'd have to do this for every *grep variant, so instead of 
> creating different aliases, I'm creating different scripts, which is an 
> even greater change :-(
> 
> Is there really no other way?
> 
> I hope nobody removes PAGER, LESS or HISTCONTROL anytime soon :-\
> 
> Christian.
> -- 
> BOFH excuse #88:
> 
> Boss' kid fucked up the machine
> 
> 

Please think to use grep -F and grep -E instead of fgrep and egrep.
For others, you can use following script, or customize grep's source
code and rebuild it to change default.

--
mv /bin/grep /bin/grep.bin
cat <<EOF >/bin/grep
#! /bin/sh
exec /bin/grep.bin --color=auto --devices=skip "$@"
EOF
chmod a+x /bin/grep
--


--
diff -ru grep-2.21.orig/src/grep.c grep-2.21/src/grep.c
--- grep-2.21.orig/src/grep.c   2014-11-09 19:00:37.000000000 +0000
+++ grep-2.21/src/grep.c        2015-03-05 15:26:59.000000000 +0000
@@ -72,7 +72,7 @@
 static bool suppress_errors;

 /* If nonzero, use color markers.  */
-static int color_option;
+static int color_option = 2;

 /* Show only the part of a line matching the expression. */
 static bool only_matching;
@@ -391,7 +391,7 @@
     READ_COMMAND_LINE_DEVICES,
     READ_DEVICES,
     SKIP_DEVICES
-  } devices = READ_COMMAND_LINE_DEVICES;
+  } devices = SKIP_DEVICES;

 static bool grepfile (int, char const *, bool, bool);
 static bool grepdesc (int, bool);
--





This bug report was last modified 10 years and 133 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.