Subject: Re: bug#19998: GREP_OPTIONS alternative?

From: Christian Kujau <[email-masked]>
Date: Thu, 5 Mar 2015 11:24:56 -0800 (PST)

On Fri, 6 Mar 2015 at 00:29, Norihiro Tanaka wrote:
> 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.

OK, that (and the bits below) seem to confirm that there's no simple 
alternative to GREP_OPTIONS and one has to make serious changes to mimic 
that behaviour. Oh well...

Thanks for your input though.

Christian.

> 
> --
> 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);
> --
> 
> 

-- 
BOFH excuse #119:

evil hackers from Serbia.