aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc.d/grep.bash
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2013-08-05 00:32:53 +1200
committerTom Ryder <tom@sanctum.geek.nz>2013-08-05 00:32:53 +1200
commitfd760f78eda9273941179024ad2588b9191f4735 (patch)
tree896710a417dd4bce65839deb88e38cd4e2bb357e /bash/bashrc.d/grep.bash
parentAdd sprunge script for my convenience (diff)
downloaddotfiles-fd760f78eda9273941179024ad2588b9191f4735.tar.gz
dotfiles-fd760f78eda9273941179024ad2588b9191f4735.zip
Improve color detection logic for prompt/ls/grep
Use tput properly and only when found and necessary
Diffstat (limited to 'bash/bashrc.d/grep.bash')
-rw-r--r--bash/bashrc.d/grep.bash2
1 files changed, 1 insertions, 1 deletions
diff --git a/bash/bashrc.d/grep.bash b/bash/bashrc.d/grep.bash
index 62acdb01..37061916 100644
--- a/bash/bashrc.d/grep.bash
+++ b/bash/bashrc.d/grep.bash
@@ -2,7 +2,7 @@
__grepopts() {
local grepopts='-I'
local grephelp="$(grep --help 2>/dev/null)"
- if [[ "$grephelp" == *--color* ]]; then
+ if [[ "$grephelp" == *--color* && "$(tput colors)" -ge 8 ]]; then
grepopts="${grepopts} --color=auto"
fi
if [[ "$grephelp" == *--exclude* ]]; then