aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc.d
diff options
context:
space:
mode:
Diffstat (limited to 'bash/bashrc.d')
-rw-r--r--bash/bashrc.d/grep.bash6
-rw-r--r--bash/bashrc.d/ls.bash4
2 files changed, 7 insertions, 3 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
diff --git a/bash/bashrc.d/ls.bash b/bash/bashrc.d/ls.bash
index 5456bf99..7093cd7c 100644
--- a/bash/bashrc.d/ls.bash
+++ b/bash/bashrc.d/ls.bash
@@ -2,7 +2,9 @@
# checks that color is available in the terminal within the function
if [[ $LS_COLORS ]] ; then
ls() {
- local -i colors=$(tput colors 2>/dev/null)
+ local -i colors=$( {
+ tput Co || tput colors
+ } 2>/dev/null )
if ((colors >= 8)) ; then
command ls --color=auto "$@"
else