diff options
author | Robby Russell <robby@planetargon.com> | 2015-02-22 10:17:16 -0800 |
---|---|---|
committer | Robby Russell <robby@planetargon.com> | 2015-02-22 10:17:16 -0800 |
commit | ff6ca9b85643e13ae23b9f47d86eb34dcc5ed576 (patch) | |
tree | 098b1b829e14caa2e63231e14bcb11311f857f6c | |
parent | e2fd99a4855f1b3b424fcc1f7234ac46f965e6a0 (diff) | |
parent | f2130fa1a3f440418a6c48f9bace43ce7443117f (diff) | |
download | zsh-ff6ca9b85643e13ae23b9f47d86eb34dcc5ed576.tar.gz zsh-ff6ca9b85643e13ae23b9f47d86eb34dcc5ed576.tar.bz2 zsh-ff6ca9b85643e13ae23b9f47d86eb34dcc5ed576.zip |
Merge pull request #3538 from TheLinuxKitten/grep-if-color
Test if --color=auto is a valid option for grep
-rw-r--r-- | lib/grep.zsh | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/grep.zsh b/lib/grep.zsh index 348ebe623..3fa103d19 100644 --- a/lib/grep.zsh +++ b/lib/grep.zsh @@ -3,8 +3,12 @@ grep-flag-available() { echo | grep $1 "" >/dev/null 2>&1 } +GREP_OPTIONS="" + # color grep results -GREP_OPTIONS="--color=auto" +if grep-flag-available --color=auto; then + GREP_OPTIONS+=" --color=auto" +fi # ignore VCS folders (if the necessary grep flags are available) VCS_FOLDERS="{.bzr,.cvs,.git,.hg,.svn}" |