]> git.pld-linux.org Git - packages/coreutils.git/commitdiff
- Fixes suggested by glen - TX
authoradgor <adgor@pld-linux.org>
Mon, 2 Oct 2006 09:18:30 +0000 (09:18 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
  - Use awk instead of grep, cut, head etc.
  - Parse last (not first) definition (if multiple are)

Changed files:
    fileutils.csh -> 1.5
    fileutils.sh -> 1.7

fileutils.csh
fileutils.sh

index e1ad6a66018d273b030c70dfb96e67c9431daf0c..4b7249ead106e4f9d59cdd7da2ac0596105cdb0b 100644 (file)
@@ -2,11 +2,11 @@ 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-`
+set COLOR_MODE=`awk '/^COLOR/{c=$2} END{print c}' $SYS_RC_FILE`
 
 test -r $USER_RC_FILE
 if ($status == 0) then
-       set COLOR_MODE=`grep ^COLOR $USER_RC_FILE |head -n 1|cut -c 7-`
+       set COLOR_MODE=`awk '/^COLOR/{c=$2} END{print c}' $USER_RC_FILE`
 endif
 
 # 'all' argument for 'ls --color=' is no longer valid
index 77f843c8747788106c44e1222591ee57b0cb6db1..d28d074d9ba421cd2d505d74cb1890254c6cdc22 100644 (file)
@@ -2,9 +2,9 @@ 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-`
+COLOR_MODE=`awk '/^COLOR/{c=$2} END{print c}' $SYS_RC_FILE`
 
-[ -r $USER_RC_FILE ] && COLOR_MODE=`grep ^COLOR $USER_RC_FILE |head -n 1|cut -c 7-`
+[ -r $USER_RC_FILE ] && COLOR_MODE=`awk '/^COLOR/{c=$2} END{print c}' $USER_RC_FILE`
 
 # 'all' argument for 'ls --color=' is no longer valid
 [ "$COLOR_MODE" = all ] && COLOR_MODE=always
This page took 0.058157 seconds and 4 git commands to generate.