2009-03-27 12:34:11 +01:00
|
|
|
# color-ls initialization
|
|
|
|
|
|
|
|
#when USER_LS_COLORS defined do not override user LS_COLORS, but use them.
|
|
|
|
if [ -z "$USER_LS_COLORS" ]; then
|
|
|
|
|
|
|
|
alias ll='ls -l' 2>/dev/null
|
|
|
|
alias l.='ls -d .*' 2>/dev/null
|
|
|
|
|
|
|
|
|
|
|
|
# Skip the rest for noninteractive shells.
|
|
|
|
[ -z "$PS1" ] && return
|
|
|
|
|
|
|
|
COLORS=
|
|
|
|
|
|
|
|
for colors in "$HOME/.dir_colors.$TERM" "$HOME/.dircolors.$TERM" \
|
|
|
|
"$HOME/.dir_colors" "$HOME/.dircolors"; do
|
|
|
|
[ -e "$colors" ] && COLORS="$colors" && break
|
|
|
|
done
|
|
|
|
|
2015-03-22 09:30:29 +01:00
|
|
|
[ -z "$COLORS" ] && [ -e "/etc/colors/DIR_COLORS.256color" ] && \
|
2009-03-27 12:34:11 +01:00
|
|
|
[ "x`tput colors 2>/dev/null`" = "x256" ] && \
|
2015-03-22 09:30:29 +01:00
|
|
|
COLORS="/etc/colors/DIR_COLORS.256color"
|
2009-03-27 12:34:11 +01:00
|
|
|
|
|
|
|
if [ -z "$COLORS" ]; then
|
2015-03-22 09:30:29 +01:00
|
|
|
for colors in "/etc/colors/DIR_COLORS.$TERM" "/etc/colors/DIR_COLORS" ; do
|
2009-03-27 12:34:11 +01:00
|
|
|
[ -e "$colors" ] && COLORS="$colors" && break
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Existence of $COLORS already checked above.
|
|
|
|
[ -n "$COLORS" ] || return
|
|
|
|
|
|
|
|
eval `dircolors --sh "$COLORS" 2>/dev/null`
|
|
|
|
[ -z "$LS_COLORS" ] && return
|
2012-01-29 20:22:34 +01:00
|
|
|
grep -Eqi "^COLOR.*none" $COLORS >/dev/null 2>/dev/null && return
|
2009-03-27 12:34:11 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
alias ll='ls -l --color=auto' 2>/dev/null
|
|
|
|
alias l.='ls -d .* --color=auto' 2>/dev/null
|
|
|
|
alias ls='ls --color=auto' 2>/dev/null
|