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
|
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
|
2015-06-04 08:47:11 +00:00
|
|
|
set INCLUDE="`/usr/bin/cat "$COLORS" | /usr/bin/grep '^INCLUDE' | /usr/bin/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
|
|
|
|
2015-06-04 08:47:11 +00:00
|
|
|
set _tmp="`/usr/bin/mktemp .colorlsXXX -q --tmpdir=/tmp`"
|
2014-10-15 07:43:08 +00:00
|
|
|
#if mktemp fails, exit when include was active, otherwise use $COLORS file
|
|
|
|
if ( "$_tmp" == '' ) then
|
|
|
|
if ( "$INCLUDE" == '' ) then
|
2015-06-04 08:47:11 +00:00
|
|
|
eval "`/usr/bin/dircolors -c $COLORS`"
|
2014-10-15 07:43:08 +00:00
|
|
|
endif
|
|
|
|
goto cleanup
|
|
|
|
endif
|
2013-05-08 15:25:06 +00:00
|
|
|
|
2015-06-04 08:47:11 +00:00
|
|
|
if ( "$INCLUDE" != '' ) /usr/bin/cat "$INCLUDE" >> $_tmp
|
|
|
|
/usr/bin/grep -v '^INCLUDE' "$COLORS" >> $_tmp
|
2013-03-11 15:00:59 +00:00
|
|
|
|
2015-06-04 08:47:11 +00:00
|
|
|
eval "`/usr/bin/dircolors -c $_tmp`"
|
2007-02-26 13:04:00 +00:00
|
|
|
|
2015-06-04 08:47:11 +00:00
|
|
|
/usr/bin/rm -f $_tmp
|
2013-05-08 15:25:06 +00:00
|
|
|
|
2008-02-04 16:49:24 +00:00
|
|
|
if ( "$LS_COLORS" == '' ) exit
|
2014-10-15 07:43:08 +00:00
|
|
|
cleanup:
|
2015-06-04 08:47:11 +00:00
|
|
|
set color_none=`/usr/bin/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'
|