|
 |
70e639 |
# skip everything for non-interactive shells
|
|
 |
70e639 |
if (! $?prompt) exit
|
|
 |
70e639 |
|
|
 |
47d86b |
# color-ls initialization
|
|
 |
47d86b |
if ( $?USER_LS_COLORS ) then
|
|
 |
47d86b |
if ( "$USER_LS_COLORS" != "" ) then
|
|
 |
47d86b |
#when USER_LS_COLORS defined do not override user
|
|
 |
47d86b |
#specified LS_COLORS and use them
|
|
 |
47d86b |
goto finish
|
|
 |
47d86b |
endif
|
|
 |
47d86b |
endif
|
|
 |
47d86b |
|
|
 |
47d86b |
alias ll 'ls -l'
|
|
 |
47d86b |
alias l. 'ls -d .*'
|
|
 |
47d86b |
set COLORS=/etc/DIR_COLORS
|
|
 |
47d86b |
|
|
 |
47d86b |
if ($?TERM) then
|
|
 |
47d86b |
if ( -e "/etc/DIR_COLORS.256color" ) then
|
|
 |
fc4c3c |
if ( "`/usr/bin/tput colors`" == "256" ) then
|
|
 |
47d86b |
set COLORS=/etc/DIR_COLORS.256color
|
|
 |
47d86b |
endif
|
|
 |
47d86b |
endif
|
|
 |
47d86b |
if ( -e "/etc/DIR_COLORS.$TERM" ) then
|
|
 |
47d86b |
set COLORS="/etc/DIR_COLORS.$TERM"
|
|
 |
47d86b |
endif
|
|
 |
47d86b |
endif
|
|
 |
47d86b |
if ( -f ~/.dircolors ) set COLORS=~/.dircolors
|
|
 |
47d86b |
if ( -f ~/.dir_colors ) set COLORS=~/.dir_colors
|
|
 |
47d86b |
if ($?TERM) then
|
|
 |
47d86b |
if ( -f ~/.dircolors."$TERM" ) set COLORS=~/.dircolors."$TERM"
|
|
 |
47d86b |
if ( -f ~/.dir_colors."$TERM" ) set COLORS=~/.dir_colors."$TERM"
|
|
 |
47d86b |
endif
|
|
 |
fc4c3c |
set INCLUDE="`/usr/bin/cat "$COLORS" | /usr/bin/grep '^INCLUDE' | /usr/bin/cut -d ' ' -f2-`"
|
|
 |
47d86b |
|
|
 |
47d86b |
if ( ! -e "$COLORS" ) exit
|
|
 |
47d86b |
|
|
 |
fc4c3c |
set _tmp="`/usr/bin/mktemp .colorlsXXX -q --tmpdir=/tmp`"
|
|
 |
fc4c3c |
#if mktemp fails, exit when include was active, otherwise use $COLORS file
|
|
 |
fc4c3c |
if ( "$_tmp" == '' ) then
|
|
 |
fc4c3c |
if ( "$INCLUDE" == '' ) then
|
|
 |
fc4c3c |
eval "`/usr/bin/dircolors -c $COLORS`"
|
|
 |
fc4c3c |
endif
|
|
 |
fc4c3c |
goto cleanup
|
|
 |
fc4c3c |
endif
|
|
 |
47d86b |
|
|
 |
fc4c3c |
if ( "$INCLUDE" != '' ) /usr/bin/cat "$INCLUDE" >> $_tmp
|
|
 |
fc4c3c |
/usr/bin/grep -v '^INCLUDE' "$COLORS" >> $_tmp
|
|
 |
47d86b |
|
|
 |
fc4c3c |
eval "`/usr/bin/dircolors -c $_tmp`"
|
|
 |
47d86b |
|
|
 |
fc4c3c |
/usr/bin/rm -f $_tmp
|
|
 |
47d86b |
|
|
 |
47d86b |
if ( "$LS_COLORS" == '' ) exit
|
|
 |
fc4c3c |
cleanup:
|
|
 |
fc4c3c |
set color_none=`/usr/bin/sed -n '/^COLOR.*none/Ip' < $COLORS`
|
|
 |
47d86b |
if ( "$color_none" != '' ) then
|
|
 |
47d86b |
unset color_none
|
|
 |
47d86b |
exit
|
|
 |
47d86b |
endif
|
|
 |
47d86b |
unset color_none
|
|
 |
47d86b |
unset _tmp
|
|
 |
70e639 |
unset INCLUDE
|
|
 |
70e639 |
unset COLORS
|
|
 |
47d86b |
|
|
 |
47d86b |
finish:
|
|
 |
47d86b |
alias ll 'ls -l --color=auto'
|
|
 |
47d86b |
alias l. 'ls -d .* --color=auto'
|
|
 |
47d86b |
alias ls 'ls --color=auto'
|