| 192 |
- |
1 |
# skip everything for non-interactive shells
|
|
|
2 |
if (! $?prompt) exit
|
|
|
3 |
|
|
|
4 |
# color-ls initialization
|
|
|
5 |
if ( $?USER_LS_COLORS ) then
|
|
|
6 |
if ( "$USER_LS_COLORS" != "" ) then
|
|
|
7 |
#when USER_LS_COLORS defined do not override user
|
|
|
8 |
#specified LS_COLORS and use them
|
|
|
9 |
goto finish
|
|
|
10 |
endif
|
|
|
11 |
endif
|
|
|
12 |
|
|
|
13 |
alias ll 'ls -l'
|
|
|
14 |
alias l. 'ls -d .*'
|
|
|
15 |
set COLORS=/etc/DIR_COLORS
|
|
|
16 |
|
|
|
17 |
if ($?TERM) then
|
|
|
18 |
if ( -e "/etc/DIR_COLORS.256color" ) then
|
|
|
19 |
if ( "`/usr/bin/tput colors`" == "256" ) then
|
|
|
20 |
set COLORS=/etc/DIR_COLORS.256color
|
|
|
21 |
endif
|
|
|
22 |
endif
|
|
|
23 |
if ( -e "/etc/DIR_COLORS.$TERM" ) then
|
|
|
24 |
set COLORS="/etc/DIR_COLORS.$TERM"
|
|
|
25 |
endif
|
|
|
26 |
endif
|
|
|
27 |
if ( -f ~/.dircolors ) set COLORS=~/.dircolors
|
|
|
28 |
if ( -f ~/.dir_colors ) set COLORS=~/.dir_colors
|
|
|
29 |
if ($?TERM) then
|
|
|
30 |
if ( -f ~/.dircolors."$TERM" ) set COLORS=~/.dircolors."$TERM"
|
|
|
31 |
if ( -f ~/.dir_colors."$TERM" ) set COLORS=~/.dir_colors."$TERM"
|
|
|
32 |
endif
|
|
|
33 |
set INCLUDE="`/usr/bin/cat "$COLORS" | /usr/bin/grep '^INCLUDE' | /usr/bin/cut -d ' ' -f2-`"
|
|
|
34 |
|
|
|
35 |
if ( ! -e "$COLORS" ) exit
|
|
|
36 |
|
|
|
37 |
set _tmp="`/usr/bin/mktemp .colorlsXXX -q --tmpdir=/tmp`"
|
|
|
38 |
#if mktemp fails, exit when include was active, otherwise use $COLORS file
|
|
|
39 |
if ( "$_tmp" == '' ) then
|
|
|
40 |
if ( "$INCLUDE" == '' ) then
|
|
|
41 |
eval "`/usr/bin/dircolors -c $COLORS`"
|
|
|
42 |
endif
|
|
|
43 |
goto cleanup
|
|
|
44 |
endif
|
|
|
45 |
|
|
|
46 |
if ( "$INCLUDE" != '' ) /usr/bin/cat "$INCLUDE" >> $_tmp
|
|
|
47 |
/usr/bin/grep -v '^INCLUDE' "$COLORS" >> $_tmp
|
|
|
48 |
|
|
|
49 |
eval "`/usr/bin/dircolors -c $_tmp`"
|
|
|
50 |
|
|
|
51 |
/usr/bin/rm -f $_tmp
|
|
|
52 |
|
|
|
53 |
if ( "$LS_COLORS" == '' ) exit
|
|
|
54 |
cleanup:
|
|
|
55 |
set color_none=`/usr/bin/sed -n '/^COLOR.*none/Ip' < $COLORS`
|
|
|
56 |
if ( "$color_none" != '' ) then
|
|
|
57 |
unset color_none
|
|
|
58 |
exit
|
|
|
59 |
endif
|
|
|
60 |
unset color_none
|
|
|
61 |
unset _tmp
|
|
|
62 |
unset INCLUDE
|
|
|
63 |
unset COLORS
|
|
|
64 |
|
|
|
65 |
finish:
|
|
|
66 |
alias ll 'ls -l --color=auto'
|
|
|
67 |
alias l. 'ls -d .* --color=auto'
|
|
|
68 |
alias ls 'ls --color=auto'
|