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