diff --git a/coreutils-colorls.csh b/coreutils-colorls.csh index 5a54e45..d02fe85 100755 --- a/coreutils-colorls.csh +++ b/coreutils-colorls.csh @@ -10,7 +10,6 @@ endif alias ll 'ls -l' alias l. 'ls -d .*' set COLORS=/etc/DIR_COLORS -set TMP="`mktemp .colorlsXXX --tmpdir=/tmp`" if ($?TERM) then if ( -e "/etc/DIR_COLORS.256color" ) then @@ -32,10 +31,14 @@ set INCLUDE="`cat "$COLORS" | grep '^INCLUDE' | cut -d ' ' -f2-`" if ( ! -e "$COLORS" ) exit -if ( "$INCLUDE" != '' ) cat "$INCLUDE" > $TMP -cat "$COLORS" | grep -v '^INCLUDE' >> $TMP +set _tmp="`mktemp .colorlsXXX --tmpdir=/tmp`" -eval "`dircolors -c $TMP`" +if ( "$INCLUDE" != '' ) cat "$INCLUDE" > $_tmp +grep -v '^INCLUDE' "$COLORS" >> $_tmp + +eval "`dircolors -c $_tmp`" + +rm -f $_tmp if ( "$LS_COLORS" == '' ) exit set color_none=`sed -n '/^COLOR.*none/Ip' < $COLORS` @@ -44,7 +47,7 @@ if ( "$color_none" != '' ) then exit endif unset color_none -rm -f $TMP +unset _tmp finish: alias ll 'ls -l --color=auto' diff --git a/coreutils-colorls.sh b/coreutils-colorls.sh index 5347b2a..7d27940 100755 --- a/coreutils-colorls.sh +++ b/coreutils-colorls.sh @@ -12,7 +12,6 @@ if [ -z "$USER_LS_COLORS" ]; then INCLUDE= COLORS= - TMP="`mktemp .colorlsXXX --tmpdir=/tmp`" for colors in "$HOME/.dir_colors.$TERM" "$HOME/.dircolors.$TERM" \ "$HOME/.dir_colors" "$HOME/.dircolors"; do @@ -34,13 +33,17 @@ if [ -z "$USER_LS_COLORS" ]; then # Existence of $COLORS already checked above. [ -n "$COLORS" ] || return + TMP="`mktemp .colorlsXXX --tmpdir=/tmp`" + [ -e "$INCLUDE" ] && cat "$INCLUDE" > $TMP - cat "$COLORS" | grep -v '^INCLUDE' >> $TMP + grep -v '^INCLUDE' "$COLORS" >> $TMP eval "`dircolors --sh $TMP 2>/dev/null`" + + rm -f $TMP + [ -z "$LS_COLORS" ] && return grep -qi "^COLOR.*none" $COLORS >/dev/null 2>/dev/null && return - rm -f $TMP fi alias ll='ls -l --color=auto' 2>/dev/null diff --git a/coreutils.spec b/coreutils.spec index 48b39f5..61f66b9 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -375,6 +375,9 @@ fi %{_sbindir}/chroot %changelog +* Wed Aug 14 2013 Ondrej Oprala