bug-grep
[Top][All Lists]
Advanced

[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: Tue, 3 Mar 2015 21:55:18 -0800 (PST)
User-agent: Alpine 2.19.4 (DEB 40 2013-11-18)

Hi,

much to my dismay I noticed that GREP_OPTIONS has been made obsolete. I 
usually kept the following in my .profile:

  export GREP_OPTIONS='--color=tty --devices=skip'

which was honored by GNU/grep and BSD/grep and ignored by e.g 
SUNWcsu/grep. Without GREP_OPTIONS, I have to put something like this in 
my .profile:

if grep --version 2>/dev/null | egrep -q 'GNU|BSD' 2>/dev/null; then
        alias   grep='grep   --color=auto --devices=skip'
fi


But that leaves out all the other grep variants, so what I really have in 
my .profile now is something like this:

if grep --version 2>/dev/null | egrep -q 'GNU|BSD' 2>/dev/null; then
        alias   grep='grep   --color=auto --devices=skip'
        alias  egrep='egrep  --color=auto --devices=skip'
        alias  fgrep='fgrep  --color=auto --devices=skip'
        alias  zgrep='zgrep  --color=auto --devices=skip'
        alias bzgrep='bzgrep --color=auto --devices=skip'
        alias xzgrep='xzgrep --color=auto --devices=skip'
fi

(and even that leaves out bzegrep, xzfgrep, etc.)

I suspect that I'm doing it wrong - but what's the alternative to have 
some nice grep defaults and still be portable across platforms?

Thanks,
Christian.
-- 
BOFH excuse #355:

Boredom in the Kernel.





reply via email to

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