]> git.pld-linux.org Git - packages/coreutils.git/commitdiff
- Implement 'COLOR' keyword recognition (same as in fileutils.sh)
authoradgor <adgor@pld-linux.org>
Mon, 2 Oct 2006 00:34:14 +0000 (00:34 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
- Seems to work

Changed files:
    fileutils.csh -> 1.4

fileutils.csh

index 9c0a50c66e33abfe6e166009fddd03558ea480e7..e1ad6a66018d273b030c70dfb96e67c9431daf0c 100644 (file)
@@ -1,2 +1,32 @@
-alias  ls      "ls --color=tty"
-eval `/usr/bin/dircolors -c /etc/DIR_COLORS`
+set SYS_RC_FILE=/etc/DIR_COLORS
+set USER_RC_FILE=$HOME/.dir_colors
+set DEF_COLOR_MODE=tty
+
+set COLOR_MODE=`grep ^COLOR $SYS_RC_FILE |head -n 1|cut -c 7-`
+
+test -r $USER_RC_FILE
+if ($status == 0) then
+       set COLOR_MODE=`grep ^COLOR $USER_RC_FILE |head -n 1|cut -c 7-`
+endif
+
+# 'all' argument for 'ls --color=' is no longer valid
+test "$COLOR_MODE" = all
+if ($status == 0) then
+       set COLOR_MODE=always
+endif
+
+test -z "$COLOR_MODE"
+if ($status == 0) then
+       set COLOR_MODE=$DEF_COLOR_MODE
+endif
+
+alias ls "ls --color=$COLOR_MODE"
+
+test -r $USER_RC_FILE
+if ($status == 0) then
+       eval `/usr/bin/dircolors -c $USER_RC_FILE`
+else   
+       eval `/usr/bin/dircolors -c $SYS_RC_FILE`
+endif
+
+unset SYS_RC_FILE USER_RC_FILE DEF_COLOR_MODE
This page took 0.055794 seconds and 4 git commands to generate.