2013-12-23 09:50:56 +00:00
|
|
|
# skip everything for non-interactive shells
|
|
|
|
if (! $?prompt) exit
|
|
|
|
|
2007-02-26 13:04:00 +00:00
|
|
|
# color-ls initialization
|
2008-03-27 14:38:08 +00:00
|
|
|
if ( $?USER_LS_COLORS ) then
|
|
|
|
if ( "$USER_LS_COLORS" != "" ) then
|
2010-04-27 10:30:50 +00:00
|
|
|
#when USER_LS_COLORS defined do not override user
|
2008-03-27 14:38:08 +00:00
|
|
|
#specified LS_COLORS and use them
|
2008-02-04 16:49:24 +00:00
|
|
|
goto finish
|
|
|
|
endif
|
2008-01-31 15:55:47 +00:00
|
|
|
endif
|
|
|
|
|
2007-02-26 13:04:00 +00:00
|
|
|
alias ll 'ls -l'
|
|
|
|
alias l. 'ls -d .*'
|
|
|
|
set COLORS=/etc/DIR_COLORS
|
2013-03-11 15:00:59 +00:00
|
|
|
|
2007-02-26 13:04:00 +00:00
|
|
|
if ($?TERM) then
|
2012-04-17 13:02:56 +00:00
|
|
|
if ( -e "/etc/DIR_COLORS.256color" ) then
|
|
|
|
if ( "`tput colors`" == "256" ) then
|
|
|
|
set COLORS=/etc/DIR_COLORS.256color
|
|
|
|
endif
|
2010-04-27 10:30:50 +00:00
|
|
|
endif
|
2013-03-14 15:50:09 +00:00
|
|
|
if ( -e "/etc/DIR_COLORS.$TERM" ) then
|
|
|
|
set COLORS="/etc/DIR_COLORS.$TERM"
|
|
|
|
endif
|
2007-02-26 13:04:00 +00:00
|
|
|
endif
|
2008-02-04 16:49:24 +00:00
|
|
|
if ( -f ~/.dircolors ) set COLORS=~/.dircolors
|
|
|
|
if ( -f ~/.dir_colors ) set COLORS=~/.dir_colors
|
2007-02-26 13:04:00 +00:00
|
|
|
if ($?TERM) then
|
2008-02-04 16:49:24 +00:00
|
|
|
if ( -f ~/.dircolors."$TERM" ) set COLORS=~/.dircolors."$TERM"
|
|
|
|
if ( -f ~/.dir_colors."$TERM" ) set COLORS=~/.dir_colors."$TERM"
|
2008-01-31 15:55:47 +00:00
|
|
|
endif
|
2013-03-11 15:00:59 +00:00
|
|
|
set INCLUDE="`cat "$COLORS" | grep '^INCLUDE' | cut -d ' ' -f2-`"
|
2007-02-26 13:04:00 +00:00
|
|
|
|
2008-02-04 16:49:24 +00:00
|
|
|
if ( ! -e "$COLORS" ) exit
|
2007-02-26 13:04:00 +00:00
|
|
|
|
2013-07-17 12:30:46 +00:00
|
|
|
set _tmp="`mktemp .colorlsXXX --tmpdir=/tmp`"
|
2013-05-08 15:25:06 +00:00
|
|
|
|
2013-11-06 13:24:54 +00:00
|
|
|
if ( "$INCLUDE" != '' ) cat "$INCLUDE" >> $_tmp
|
2013-07-17 12:30:46 +00:00
|
|
|
grep -v '^INCLUDE' "$COLORS" >> $_tmp
|
2013-03-11 15:00:59 +00:00
|
|
|
|
2013-07-17 12:30:46 +00:00
|
|
|
eval "`dircolors -c $_tmp`"
|
2007-02-26 13:04:00 +00:00
|
|
|
|
2013-07-17 12:30:46 +00:00
|
|
|
rm -f $_tmp
|
2013-05-08 15:25:06 +00:00
|
|
|
|
2008-02-04 16:49:24 +00:00
|
|
|
if ( "$LS_COLORS" == '' ) exit
|
2007-02-26 13:04:00 +00:00
|
|
|
set color_none=`sed -n '/^COLOR.*none/Ip' < $COLORS`
|
2010-04-27 10:30:50 +00:00
|
|
|
if ( "$color_none" != '' ) then
|
2008-02-04 16:49:24 +00:00
|
|
|
unset color_none
|
|
|
|
exit
|
2007-02-26 13:04:00 +00:00
|
|
|
endif
|
|
|
|
unset color_none
|
2013-07-17 12:30:46 +00:00
|
|
|
unset _tmp
|
2014-01-13 11:49:45 +00:00
|
|
|
unset INCLUDE
|
|
|
|
unset COLORS
|
2008-02-04 16:49:24 +00:00
|
|
|
|
|
|
|
finish:
|
2008-02-18 14:37:04 +00:00
|
|
|
alias ll 'ls -l --color=auto'
|
|
|
|
alias l. 'ls -d .* --color=auto'
|
|
|
|
alias ls 'ls --color=auto'
|