aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitch Riedstra <mitch@riedstra.us>2019-10-20 09:18:54 -0400
committerMitch Riedstra <mitch@riedstra.us>2019-10-20 09:19:38 -0400
commitd022051f5c4f1734204d180eaf93fbc9971810f3 (patch)
tree304bbb927b3635b878531748d796bc27edf97938
parent97b8b23c403f152c7f995c037607869d21b97762 (diff)
downloaddotfiles-d022051f5c4f1734204d180eaf93fbc9971810f3.tar.gz
dotfiles-d022051f5c4f1734204d180eaf93fbc9971810f3.tar.xz
Fix up my test for whether grep supports color
-rw-r--r--mkshrc3
-rw-r--r--shell/aliases3
2 files changed, 2 insertions, 4 deletions
diff --git a/mkshrc b/mkshrc
index f6b911b..1d43233 100644
--- a/mkshrc
+++ b/mkshrc
@@ -53,8 +53,7 @@ setcoloraliases() {
alias lm='CLICOLOR_FORCE="1" ls -l | less -r';
fi
- grep --help | grep fucks - >/dev/null 2>&1
- if [ $? -eq 0 ] ; then
+ if echo "color test" | grep -q --color=auto "color test" >/dev/null 2>&1 ; then
alias grep="grep --color=auto";
alias egrep='egrep --color=auto'
alias search='egrep --color=auto -rnI';
diff --git a/shell/aliases b/shell/aliases
index 120db9c..b8f7548 100644
--- a/shell/aliases
+++ b/shell/aliases
@@ -40,8 +40,7 @@ setcoloraliases() {
alias lm='CLICOLOR_FORCE="1" ls -l | less -r';
fi
- grep --help | grep fucks - >/dev/null 2>&1
- if [ $? -eq 0 ] ; then
+ if echo "color test" | grep -q --color=auto "color test" >/dev/null 2>&1 ; then
alias grep="grep --color=auto";
alias egrep='egrep --color=auto'
alias search='egrep --color=auto -rnI';