aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc.d/grep.bash
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2015-05-31 01:15:30 +1200
committerTom Ryder <tom@sanctum.geek.nz>2015-05-31 01:15:30 +1200
commit5ccd692805f5978057fffc718bf194be80d5d70f (patch)
tree3bed55ce57c79f78ab6baabffe27e26fb881ef62 /bash/bashrc.d/grep.bash
parentForce integer type on color check (diff)
downloaddotfiles-5ccd692805f5978057fffc718bf194be80d5d70f.tar.gz
dotfiles-5ccd692805f5978057fffc718bf194be80d5d70f.zip
Consistent color count method
Diffstat (limited to 'bash/bashrc.d/grep.bash')
-rw-r--r--bash/bashrc.d/grep.bash6
1 files changed, 4 insertions, 2 deletions
diff --git a/bash/bashrc.d/grep.bash b/bash/bashrc.d/grep.bash
index 559b5e09..0eedb451 100644
--- a/bash/bashrc.d/grep.bash
+++ b/bash/bashrc.d/grep.bash
@@ -2,9 +2,11 @@
# set; checks that color is available in the terminal within the function
if [[ $GREP_COLORS ]] ; then
grep() {
- local -i colors=$(tput colors 2>/dev/null)
+ local -i colors=$( {
+ tput Co || tput colors
+ } 2>/dev/null )
if ((colors >= 8)) ; then
- command grep --color "$@"
+ command grep --color=auto "$@"
else
command grep "$@"
fi