[utility] Use CLICOLOR for coloured output in BSD
instead of aliasing `ls` to `ls -G`. CLICOLOR is detected not only by `ls`, but by `tree` too (starting with version 1.8.0). See http://mama.indstate.edu/users/ice/tree/changes.html It's probably more widely used by other tools too.
This commit is contained in:
parent
1c23ea1604
commit
268a570ae3
1 changed files with 3 additions and 6 deletions
|
@ -22,15 +22,12 @@ if (( terminfo[colors] >= 8 )); then
|
||||||
else
|
else
|
||||||
# BSD
|
# BSD
|
||||||
|
|
||||||
|
(( ! ${+CLICOLOR} )) && export CLICOLOR=1
|
||||||
(( ! ${+LSCOLORS} )) && export LSCOLORS='ExfxcxdxbxGxDxabagacad'
|
(( ! ${+LSCOLORS} )) && export LSCOLORS='ExfxcxdxbxGxDxabagacad'
|
||||||
|
|
||||||
# stock OpenBSD ls does not support colors at all, but colorls does.
|
# stock OpenBSD ls does not support colors at all, but colorls does.
|
||||||
if [[ ${OSTYPE} == openbsd* ]]; then
|
if [[ ${OSTYPE} == openbsd* && ${+commands[colorls]} -ne 0 ]]; then
|
||||||
if (( ${+commands[colorls]} )); then
|
alias ls='colorls'
|
||||||
alias ls='colorls -G'
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
alias ls='ls -G'
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue