From d022051f5c4f1734204d180eaf93fbc9971810f3 Mon Sep 17 00:00:00 2001 From: Mitch Riedstra Date: Sun, 20 Oct 2019 09:18:54 -0400 Subject: Fix up my test for whether grep supports color --- mkshrc | 3 +-- shell/aliases | 3 +-- 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'; -- cgit v1.2.3