SOURCES: fileutils.sh - Honor 'COLOR' setting && ~/.dir_colors
adgor
adgor at pld-linux.org
Sun Oct 1 23:41:52 CEST 2006
Author: adgor Date: Sun Oct 1 21:41:52 2006 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- Honor 'COLOR' setting && ~/.dir_colors
---- Files affected:
SOURCES:
fileutils.sh (1.3 -> 1.4)
---- Diffs:
================================================================
Index: SOURCES/fileutils.sh
diff -u SOURCES/fileutils.sh:1.3 SOURCES/fileutils.sh:1.4
--- SOURCES/fileutils.sh:1.3 Thu Sep 30 17:51:19 2004
+++ SOURCES/fileutils.sh Sun Oct 1 23:41:47 2006
@@ -1,2 +1,17 @@
-alias ls="ls --color=tty"
-eval `/usr/bin/dircolors -b /etc/DIR_COLORS`
+SYS_RC_FILE=/etc/DIR_COLORS
+USER_RC_FILE=$HOME/.dir_colors
+DEF_COLOR_MODE=tty
+
+COLOR_MODE=`grep ^COLOR $SYS_RC_FILE |head -n 1|cut -c 7-`
+
+[ -r $USER_RC_FILE ] && COLOR_MODE=`grep ^COLOR $USER_RC_FILE |head -n 1|cut -c 7-`
+
+[ -z "$COLOR_MODE" ] && COLOR_MODE=$DEF_COLOR_MODE
+
+alias ls="ls --color=$COLOR_MODE"
+
+if [ -r $USER_RC_FILE ]; then
+ eval `/usr/bin/dircolors -b $USER_RC_FILE`
+else
+ eval `/usr/bin/dircolors -b $SYS_RC_FILE`
+fi
================================================================
---- CVS-web:
http://cvs.pld-linux.org/SOURCES/fileutils.sh?r1=1.3&r2=1.4&f=u
More information about the pld-cvs-commit
mailing list