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'. Anyway, it's worth documenting the script alternative, so I installed the attached into the manual and am marking the bug as done.
>From cd5e8b1071296d930a88d60789f24abab941b81a Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@cs.ucla.edu>
Date: Wed, 11 Mar 2015 11:14:51 -0700
Subject: [PATCH] doc: give a script wrapper example

* doc/grep.texi (Environment Variables): Give an example of a
wrapper script, as an alternative to using GREP_OPTIONS.
Fixes: bug#19998
---
 doc/grep.texi | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/doc/grep.texi b/doc/grep.texi
index 18a1102..e3495bb 100644
--- a/doc/grep.texi
+++ b/doc/grep.texi
@@ -838,6 +838,15 @@ explicit options.
 As this causes problems when writing portable scripts, this feature
 will be removed in a future release of @command{grep}, and @command{grep}
 warns if it is used.  Please use an alias or script instead.
+For example, if @command{grep} is in the directory @samp{/usr/bin} you
+can prepend @file{$HOME/bin} to your @env{PATH} and create an
+executable script @file{$HOME/bin/grep} containing the following:
+
+@example
+#! /bin/sh
+export PATH=/usr/bin
+exec grep --color=auto --devices=skip "$@@"
+@end example
 
 @item GREP_COLOR
 @vindex GREP_COLOR @r{environment variable}
-- 
2.1.0

Reply via email to