diff options
Diffstat (limited to 'bash/bashrc.d/ls.bash')
-rw-r--r-- | bash/bashrc.d/ls.bash | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/bash/bashrc.d/ls.bash b/bash/bashrc.d/ls.bash index 7093cd7c..c47859c9 100644 --- a/bash/bashrc.d/ls.bash +++ b/bash/bashrc.d/ls.bash @@ -1,15 +1,18 @@ # Define function wrapper for ls(1) with --color option if LS_COLORS is set; # checks that color is available in the terminal within the function -if [[ $LS_COLORS ]] ; then - ls() { - local -i colors=$( { - tput Co || tput colors - } 2>/dev/null ) - if ((colors >= 8)) ; then - command ls --color=auto "$@" - else - command ls "$@" - fi - } +if ! [[ $LS_COLORS ]] ; then + return fi +# Define function proper +ls() { + local -i colors=$( { + tput Co || tput colors + } 2>/dev/null ) + if ((colors >= 8)) ; then + command ls --color=auto "$@" + else + command ls "$@" + fi +} + |