ohmyzsh/lib/grep.zsh
修昊 8173276760 fix bug
fix this warnning : grep: warning: GREP_OPTIONS is deprecated; please use an alias or script
2014-12-10 14:51:29 +08:00

25 lines
635 B
Bash

#
# Color grep results
# Examples: http://rubyurl.com/ZXv
#
GREP_OPTIONS="--color=auto"
# avoid VCS folders (if the necessary grep flags are available)
grep-flag-available() {
echo | grep $1 "" >/dev/null 2>&1
}
if grep-flag-available --exclude-dir=.cvs; then
for PATTERN in .cvs .git .hg .svn; do
GREP_OPTIONS+=" --exclude-dir=$PATTERN"
done
elif grep-flag-available --exclude=.cvs; then
for PATTERN in .cvs .git .hg .svn; do
GREP_OPTIONS+=" --exclude=$PATTERN"
done
fi
unfunction grep-flag-available
# export GREP_OPTIONS="$GREP_OPTIONS"
alias grep="grep $GREPOPTIONS"
export GREP_COLOR='1;32'