aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc.d/grep.bash
diff options
context:
space:
mode:
Diffstat (limited to 'bash/bashrc.d/grep.bash')
-rw-r--r--bash/bashrc.d/grep.bash3
1 files changed, 2 insertions, 1 deletions
diff --git a/bash/bashrc.d/grep.bash b/bash/bashrc.d/grep.bash
index da391193..942bb9af 100644
--- a/bash/bashrc.d/grep.bash
+++ b/bash/bashrc.d/grep.bash
@@ -3,7 +3,8 @@ __grepopts() {
local -a grepopts
local grephelp="$(grep --help 2>/dev/null)"
grepopts[${#grepopts[@]}]='-I'
- if [[ "$grephelp" == *--color* && "$(tput colors)" -ge 8 ]]; then
+ local -i colors="$(tput colors)"
+ if [[ "$grephelp" == *--color* ]] && ((colors >= 8)); then
grepopts[${#grepopts[@]}]='--color=auto'
fi
if [[ "$grephelp" == *--exclude* ]]; then