diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2013-08-05 00:32:53 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2013-08-05 00:32:53 +1200 |
commit | fd760f78eda9273941179024ad2588b9191f4735 (patch) | |
tree | 896710a417dd4bce65839deb88e38cd4e2bb357e /bash/bashrc.d/ls.bash | |
parent | Add sprunge script for my convenience (diff) | |
download | dotfiles-fd760f78eda9273941179024ad2588b9191f4735.tar.gz dotfiles-fd760f78eda9273941179024ad2588b9191f4735.zip |
Improve color detection logic for prompt/ls/grep
Use tput properly and only when found and necessary
Diffstat (limited to 'bash/bashrc.d/ls.bash')
-rw-r--r-- | bash/bashrc.d/ls.bash | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/bash/bashrc.d/ls.bash b/bash/bashrc.d/ls.bash index d1afd04c..0fda4ed8 100644 --- a/bash/bashrc.d/ls.bash +++ b/bash/bashrc.d/ls.bash @@ -2,7 +2,7 @@ __lsopts() { local lsopts= local lshelp="$(ls --help 2>/dev/null)" - if [[ "$lshelp" == *--color* ]]; then + if [[ "$lshelp" == *--color* && "$(tput colors)" -ge 8 ]]; then lsopts="${lsopts} --color=auto" fi printf '%s' "$lsopts" |