setup/profile.d/colorls.sh
2011-04-26 13:22:53 +02:00

22 lines
580 B
Bash

# color-ls initialization
alias ll='ls -l' 2>/dev/null
alias l.='ls -d .*' 2>/dev/null
COLORS=/etc/dircolors
[ -e "/etc/dircolors.$TERM" ] && COLORS="/etc/dircolors.$TERM"
[ -e "$HOME/.dircolors" ] && COLORS="$HOME/.dircolors"
[ -e "$HOME/.dircolors.$TERM" ] && COLORS="$HOME/.dircolors.$TERM"
[ -e "$COLORS" ] || return
eval `dircolors --sh "$COLORS"`
[ -z "$LS_COLORS" ] && return
if ! egrep -qi "^COLOR.*none" $COLORS &>/dev/null; then
alias ls='ls --color=tty' 2>/dev/null
alias ll='ls -l --color=tty' 2>/dev/null
alias l.='ls -d .* --color=tty' 2>/dev/null
fi