colorls profile script tmp file handling improvements
This commit is contained in:
parent
7bbf86f2fe
commit
f0b6f85aff
@ -10,7 +10,6 @@ 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
|
||||||
set TMP="`mktemp .colorlsXXX --tmpdir=/tmp`"
|
|
||||||
|
|
||||||
if ($?TERM) then
|
if ($?TERM) then
|
||||||
if ( -e "/etc/DIR_COLORS.256color" ) then
|
if ( -e "/etc/DIR_COLORS.256color" ) then
|
||||||
@ -32,11 +31,15 @@ set INCLUDE="`cat "$COLORS" | grep '^INCLUDE' | cut -d ' ' -f2-`"
|
|||||||
|
|
||||||
if ( ! -e "$COLORS" ) exit
|
if ( ! -e "$COLORS" ) exit
|
||||||
|
|
||||||
|
set TMP="`mktemp .colorlsXXX --tmpdir=/tmp`"
|
||||||
|
|
||||||
if ( "$INCLUDE" != '' ) cat "$INCLUDE" > $TMP
|
if ( "$INCLUDE" != '' ) cat "$INCLUDE" > $TMP
|
||||||
cat "$COLORS" | grep -v '^INCLUDE' >> $TMP
|
grep -v '^INCLUDE' "$COLORS" >> $TMP
|
||||||
|
|
||||||
eval "`dircolors -c $TMP`"
|
eval "`dircolors -c $TMP`"
|
||||||
|
|
||||||
|
rm -f $TMP
|
||||||
|
|
||||||
if ( "$LS_COLORS" == '' ) exit
|
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
|
||||||
@ -44,7 +47,6 @@ if ( "$color_none" != '' ) then
|
|||||||
exit
|
exit
|
||||||
endif
|
endif
|
||||||
unset color_none
|
unset color_none
|
||||||
rm -f $TMP
|
|
||||||
|
|
||||||
finish:
|
finish:
|
||||||
alias ll 'ls -l --color=auto'
|
alias ll 'ls -l --color=auto'
|
||||||
|
@ -12,7 +12,6 @@ if [ -z "$USER_LS_COLORS" ]; then
|
|||||||
|
|
||||||
INCLUDE=
|
INCLUDE=
|
||||||
COLORS=
|
COLORS=
|
||||||
TMP="`mktemp .colorlsXXX --tmpdir=/tmp`"
|
|
||||||
|
|
||||||
for colors in "$HOME/.dir_colors.$TERM" "$HOME/.dircolors.$TERM" \
|
for colors in "$HOME/.dir_colors.$TERM" "$HOME/.dircolors.$TERM" \
|
||||||
"$HOME/.dir_colors" "$HOME/.dircolors"; do
|
"$HOME/.dir_colors" "$HOME/.dircolors"; do
|
||||||
@ -34,13 +33,17 @@ if [ -z "$USER_LS_COLORS" ]; then
|
|||||||
# Existence of $COLORS already checked above.
|
# Existence of $COLORS already checked above.
|
||||||
[ -n "$COLORS" ] || return
|
[ -n "$COLORS" ] || return
|
||||||
|
|
||||||
|
TMP="`mktemp .colorlsXXX --tmpdir=/tmp`"
|
||||||
|
|
||||||
[ -e "$INCLUDE" ] && cat "$INCLUDE" > $TMP
|
[ -e "$INCLUDE" ] && cat "$INCLUDE" > $TMP
|
||||||
cat "$COLORS" | grep -v '^INCLUDE' >> $TMP
|
grep -v '^INCLUDE' "$COLORS" >> $TMP
|
||||||
|
|
||||||
eval "`dircolors --sh $TMP 2>/dev/null`"
|
eval "`dircolors --sh $TMP 2>/dev/null`"
|
||||||
|
|
||||||
|
rm -f $TMP
|
||||||
|
|
||||||
[ -z "$LS_COLORS" ] && return
|
[ -z "$LS_COLORS" ] && return
|
||||||
grep -qi "^COLOR.*none" $COLORS >/dev/null 2>/dev/null && return
|
grep -qi "^COLOR.*none" $COLORS >/dev/null 2>/dev/null && return
|
||||||
rm -f $TMP
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
alias ll='ls -l --color=auto' 2>/dev/null
|
alias ll='ls -l --color=auto' 2>/dev/null
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
Summary: A set of basic GNU tools commonly used in shell scripts
|
Summary: A set of basic GNU tools commonly used in shell scripts
|
||||||
Name: coreutils
|
Name: coreutils
|
||||||
Version: 8.21
|
Version: 8.21
|
||||||
Release: 11%{?dist}
|
Release: 12%{?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/
|
||||||
@ -375,6 +375,9 @@ fi
|
|||||||
%{_sbindir}/chroot
|
%{_sbindir}/chroot
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed May 08 2013 Ondrej Vasik <ovasik@redhat.com 8.21-12
|
||||||
|
- optimization of colorls scripts by Ville Skytta (#961012)
|
||||||
|
|
||||||
* Fri Apr 05 2013 Ondrej Oprala <ooprala@redhat.com 8.21-11
|
* Fri Apr 05 2013 Ondrej Oprala <ooprala@redhat.com 8.21-11
|
||||||
- Fix tmp file location in colorls scripts (#948008)
|
- Fix tmp file location in colorls scripts (#948008)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user