Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[FYI] "GREP_OPTIONS now depreciated"
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Thu Jan 22, 2015 12:05 pm    Post subject: [FYI] "GREP_OPTIONS now depreciated" Reply with quote

hello ... I updated grep this morning from 2.16 to 2.21-r1 to discover that GREP_OPTIONS are depreciated:

man grep wrote:
GREP_OPTIONS
This variable specifies default options to be placed in front of any explicit options. As this causes problems when writing portable scripts, this feature will be removed in a future release of grep, and grep warns if it is used. Please use an alias or script instead.

OK, fair enough ...

So, rather than write seperate scripts or aliases for grep, egrep, fgrep heres a little trickypoo.

~/.zprofile ... or ~/.bash_profile (though omit *.zwc and .zcompdump ... thats zsh thingy)
Code:
export GREP_OPTIONS="--color=auto \
 --directories=skip \
 --binary-files=without-match \
 --exclude=\*.swp \
 --exclude=\*.pyc \
 --exclude=\*.zwc\* \
 --exclude=.zcompdump\* \
 --exclude-dir=.git \
 --exclude-dir=.svn"

... or whatever you want/have defined there.

~/.zshrc
Code:
# 'setopt short_loops' needed
for i (grep egrep fgrep) alias $i="$i $GREP_OPTIONS" ;
unset GREP_OPTIONS

~/.bashrc ... (untested)
Code:
for i in grep egrep fgrep ; do
   alias $i="$i $GREP_OPTIONS" ;
done
unset GREP_OPTIONS

Thought that worth throwing out there.

best ... khay
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 3664

PostPosted: Thu Jan 22, 2015 12:26 pm    Post subject: Re: [FYI] "GREP_OPTIONS now depreciated" Reply with quote

khayyam wrote:
hello ... I updated grep this morning from 2.16 to 2.21-r1 to discover that GREP_OPTIONS are depreciated:
"Depreciated" sounds like something from fixed asset accounting :-)
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Thu Jan 22, 2015 12:46 pm    Post subject: Re: [FYI] "GREP_OPTIONS now depreciated" Reply with quote

charles17 wrote:
"Depreciated" sounds like something from fixed asset accounting :-)

charles ... that's what the man says :)

Code:
% export GREP_OPTIONS="--color=auto"
% grep blah .zshrc
grep: warning: GREP_OPTIONS is deprecated; please use an alias or script
% unset GREP_OPTIONS

... oh, no he duhnt.

best ... khay
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum