View previous topic :: View next topic |
Author |
Message |
khayyam Watchman
Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Thu Jan 22, 2015 12:05 pm Post subject: [FYI] "GREP_OPTIONS now depreciated" |
|
|
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 |
|
|
charles17 Advocate
Joined: 02 Mar 2008 Posts: 3664
|
Posted: Thu Jan 22, 2015 12:26 pm Post subject: Re: [FYI] "GREP_OPTIONS now depreciated" |
|
|
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 |
|
|
khayyam Watchman
Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Thu Jan 22, 2015 12:46 pm Post subject: Re: [FYI] "GREP_OPTIONS now depreciated" |
|
|
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 |
|
|
|