aboutsummaryrefslogtreecommitdiff
path: root/sh
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-07-11 23:57:23 +1200
committerTom Ryder <tom@sanctum.geek.nz>2017-07-11 23:57:23 +1200
commitab6cb2673a51f8582e82828b15fd62f303f54d75 (patch)
tree5a2ffee5264697de3f6eab6e112609faec891261 /sh
parentUpdate submodules (diff)
downloaddotfiles-ab6cb2673a51f8582e82828b15fd62f303f54d75.tar.gz
dotfiles-ab6cb2673a51f8582e82828b15fd62f303f54d75.zip
Gracefully handle two failed tput color calls
Diffstat (limited to 'sh')
-rw-r--r--sh/shrc.d/grep.sh2
-rw-r--r--sh/shrc.d/ls.sh2
-rw-r--r--sh/shrc.d/tree.sh2
3 files changed, 3 insertions, 3 deletions
diff --git a/sh/shrc.d/grep.sh b/sh/shrc.d/grep.sh
index dd85a198..3df1ee9a 100644
--- a/sh/shrc.d/grep.sh
+++ b/sh/shrc.d/grep.sh
@@ -14,7 +14,7 @@ grep() {
# Add --color=auto if the terminal has at least 8 colors
[ -e "$HOME"/.cache/sh/opt/grep/color ] &&
- [ "$({ tput colors || tput Co ; } 2>/dev/null)" -ge 8 ] &&
+ [ "$({ tput colors||tput Co||echo 0; } 2>/dev/null)" -ge 8 ] &&
set -- --color=auto "$@"
# Add --devices=skip to gracefully skip devices
diff --git a/sh/shrc.d/ls.sh b/sh/shrc.d/ls.sh
index b5acfcf9..d58c64f9 100644
--- a/sh/shrc.d/ls.sh
+++ b/sh/shrc.d/ls.sh
@@ -25,7 +25,7 @@ ls() {
# Add --color if the terminal has at least 8 colors
[ -e "$HOME"/.cache/sh/opt/ls/color ] &&
- [ "$({ tput colors || tput Co ; } 2>/dev/null)" -ge 8 ] &&
+ [ "$({ tput colors||tput Co||echo 0; } 2>/dev/null)" -ge 8 ] &&
set -- --color=auto "$@"
# Add --time-style='+%Y-%m-%d %H:%M:%S' to show the date in my preferred
diff --git a/sh/shrc.d/tree.sh b/sh/shrc.d/tree.sh
index b4f91df8..ca134fe2 100644
--- a/sh/shrc.d/tree.sh
+++ b/sh/shrc.d/tree.sh
@@ -21,7 +21,7 @@ tree() {
[ -t 1 ] || exit
# Not if output terminal doesn't have at least 8 colors
- [ "$({ tput colors || tput Co ; } 2>/dev/null)" -ge 8 ] || exit
+ [ "$({ tput colors||tput Co||echo 0; } 2>/dev/null)" -ge 8 ]
) ; then
set -- -C "$@"