256 color support in sh/csh colorls scripts(#429121), fixed syntax error in
csh script(#431315)
This commit is contained in:
parent
6d00d6195e
commit
6ee11ab3f6
@ -1,51 +1,45 @@
|
|||||||
#! /bin/csh -f
|
#! /bin/csh -f
|
||||||
# color-ls initialization
|
# color-ls initialization
|
||||||
if ( "$LS_COLORS" != '' ) then
|
if ( $?LS_COLORS ) then
|
||||||
#do not override user specified LS_COLORS and use them
|
if ( $LS_COLORS != "" ) then
|
||||||
alias ll 'ls -l --color=tty'
|
#do not override user specified LS_COLORS and use them
|
||||||
alias l. 'ls -d .* --color=tty'
|
goto finish
|
||||||
alias ls 'ls --color=tty'
|
endif
|
||||||
exit
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
alias ll 'ls -l'
|
alias ll 'ls -l'
|
||||||
alias l. 'ls -d .*'
|
alias l. 'ls -d .*'
|
||||||
|
|
||||||
set COLORS=/etc/DIR_COLORS
|
set COLORS=/etc/DIR_COLORS
|
||||||
if ($?TERM) then
|
if ($?TERM) then
|
||||||
if ( -e "/etc/DIR_COLORS.$TERM" ) then
|
if ( -e "/etc/DIR_COLORS.$TERM" ) then
|
||||||
set COLORS="/etc/DIR_COLORS.$TERM"
|
set COLORS="/etc/DIR_COLORS.$TERM"
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
if ( -f ~/.dircolors ) then
|
if ( -e "/etc/DIR_COLORS.256color" ) then
|
||||||
set COLORS=~/.dircolors
|
if ( "`infocmp $TERM | sed -n 's/.*colors#\([0-9]\+\).*/\1/p'`" == "256" ) then
|
||||||
endif
|
set COLORS=/etc/DIR_COLORS.256color
|
||||||
if ( -f ~/.dir_colors ) then
|
endif
|
||||||
set COLORS=~/.dir_colors
|
|
||||||
endif
|
endif
|
||||||
|
if ( -f ~/.dircolors ) set COLORS=~/.dircolors
|
||||||
|
if ( -f ~/.dir_colors ) set COLORS=~/.dir_colors
|
||||||
if ($?TERM) then
|
if ($?TERM) then
|
||||||
if ( -f ~/.dircolors."$TERM" ) then
|
if ( -f ~/.dircolors."$TERM" ) set COLORS=~/.dircolors."$TERM"
|
||||||
set COLORS=~/.dircolors."$TERM"
|
if ( -f ~/.dir_colors."$TERM" ) set COLORS=~/.dir_colors."$TERM"
|
||||||
endif
|
|
||||||
if ( -f ~/.dir_colors."$TERM" ) then
|
|
||||||
set COLORS=~/.dir_colors."$TERM"
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if ( ! -e "$COLORS" ) then
|
if ( ! -e "$COLORS" ) exit
|
||||||
exit
|
|
||||||
endif
|
|
||||||
|
|
||||||
eval `dircolors -c $COLORS`
|
eval `dircolors -c $COLORS 2>/dev/null`
|
||||||
|
|
||||||
if ( "$LS_COLORS" == '' ) then
|
|
||||||
exit
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
if ( "$LS_COLORS" == '' ) exit
|
||||||
set color_none=`sed -n '/^COLOR.*none/Ip' < $COLORS`
|
set color_none=`sed -n '/^COLOR.*none/Ip' < $COLORS`
|
||||||
if ( "$color_none" == '' ) then
|
if ( "$color_none" != '' ) then
|
||||||
alias ll 'ls -l --color=tty'
|
unset color_none
|
||||||
alias l. 'ls -d .* --color=tty'
|
exit
|
||||||
alias ls 'ls --color=tty'
|
|
||||||
endif
|
endif
|
||||||
unset color_none
|
unset color_none
|
||||||
|
|
||||||
|
finish:
|
||||||
|
alias ll 'ls -l --color=tty'
|
||||||
|
alias l. 'ls -d .* --color=tty'
|
||||||
|
alias ls 'ls --color=tty'
|
||||||
|
@ -1,28 +1,25 @@
|
|||||||
# color-ls initialization
|
# color-ls initialization
|
||||||
if [ -n "$LS_COLORS" ]; then
|
if [ -z "$LS_COLORS" ]; then
|
||||||
#do not override user LS_COLORS but use them
|
#do not override user LS_COLORS, so perform only for zero sized LS_COLORS
|
||||||
alias ll='ls -l --color=tty' 2>/dev/null
|
alias ll='ls -l' 2>/dev/null
|
||||||
alias l.='ls -d .* --color=tty' 2>/dev/null
|
alias l.='ls -d .*' 2>/dev/null
|
||||||
alias ls='ls --color=tty' 2>/dev/null
|
|
||||||
return
|
COLORS=/etc/DIR_COLORS
|
||||||
|
[ -e "/etc/DIR_COLORS.$TERM" ] && COLORS="/etc/DIR_COLORS.$TERM"
|
||||||
|
[ -e "/etc/DIR_COLORS.256color" ] && \
|
||||||
|
[ "`infocmp $TERM | sed -n 's/.*colors#\([0-9]\+\).*/\1/p'`" -eq 256 ] && \
|
||||||
|
COLORS="/etc/DIR_COLORS.256color"
|
||||||
|
[ -e "$HOME/.dircolors" ] && COLORS="$HOME/.dircolors"
|
||||||
|
[ -e "$HOME/.dir_colors" ] && COLORS="$HOME/.dir_colors"
|
||||||
|
[ -e "$HOME/.dircolors.$TERM" ] && COLORS="$HOME/.dircolors.$TERM"
|
||||||
|
[ -e "$HOME/.dir_colors.$TERM" ] && COLORS="$HOME/.dir_colors.$TERM"
|
||||||
|
[ -e "$COLORS" ] || return
|
||||||
|
|
||||||
|
eval `dircolors --sh "$COLORS" 2>/dev/null`
|
||||||
|
[ -z "$LS_COLORS" ] && return
|
||||||
|
egrep -qi "^COLOR.*none" $COLORS >/dev/null 2>/dev/null && return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
alias ll='ls -l' 2>/dev/null
|
alias ll='ls -l --color=tty' 2>/dev/null
|
||||||
alias l.='ls -d .*' 2>/dev/null
|
alias l.='ls -d .* --color=tty' 2>/dev/null
|
||||||
|
alias ls='ls --color=tty' 2>/dev/null
|
||||||
COLORS=/etc/DIR_COLORS
|
|
||||||
[ -e "/etc/DIR_COLORS.$TERM" ] && COLORS="/etc/DIR_COLORS.$TERM"
|
|
||||||
[ -e "$HOME/.dircolors" ] && COLORS="$HOME/.dircolors"
|
|
||||||
[ -e "$HOME/.dir_colors" ] && COLORS="$HOME/.dir_colors"
|
|
||||||
[ -e "$HOME/.dircolors.$TERM" ] && COLORS="$HOME/.dircolors.$TERM"
|
|
||||||
[ -e "$HOME/.dir_colors.$TERM" ] && COLORS="$HOME/.dir_colors.$TERM"
|
|
||||||
[ -e "$COLORS" ] || return
|
|
||||||
|
|
||||||
eval `dircolors --sh "$COLORS" 2>/dev/null`
|
|
||||||
[ -z "$LS_COLORS" ] && return
|
|
||||||
|
|
||||||
if ! egrep -qi "^COLOR.*none" $COLORS >/dev/null 2>/dev/null ; then
|
|
||||||
alias ll='ls -l --color=tty' 2>/dev/null
|
|
||||||
alias l.='ls -d .* --color=tty' 2>/dev/null
|
|
||||||
alias ls='ls --color=tty' 2>/dev/null
|
|
||||||
fi
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
Summary: The GNU core utilities: a set of tools commonly used in shell scripts
|
Summary: The GNU core utilities: a set of tools commonly used in shell scripts
|
||||||
Name: coreutils
|
Name: coreutils
|
||||||
Version: 6.10
|
Version: 6.10
|
||||||
Release: 4%{?dist}
|
Release: 5%{?dist}
|
||||||
License: GPLv3+
|
License: GPLv3+
|
||||||
Group: System Environment/Base
|
Group: System Environment/Base
|
||||||
Url: http://www.gnu.org/software/coreutils/
|
Url: http://www.gnu.org/software/coreutils/
|
||||||
@ -291,6 +291,10 @@ fi
|
|||||||
/sbin/runuser
|
/sbin/runuser
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Feb 4 2008 Ondrej Vasik <ovasik@redhat.com> - 6.10-5
|
||||||
|
- enabled 256-color support in colorls shell scripts(#429121)
|
||||||
|
- fixed syntax error in csh script(#431315)
|
||||||
|
|
||||||
* Thu Jan 31 2008 Ondrej Vasik <ovasik@redhat.com> - 6.10-4
|
* Thu Jan 31 2008 Ondrej Vasik <ovasik@redhat.com> - 6.10-4
|
||||||
- forgotten return in colorls.sh change
|
- forgotten return in colorls.sh change
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user