From 3061c823c0566c5efeefae12d48d4bb95c2acc7a Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Tue, 7 Jan 2003 04:58:31 +0000 Subject: speedups () - use LC_ALL=C - don't use both grep&awk on the same file, just use awk --- rc.d/init.d/rawdevices | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'rc.d/init.d/rawdevices') diff --git a/rc.d/init.d/rawdevices b/rc.d/init.d/rawdevices index b55fa14f..e0639279 100755 --- a/rc.d/init.d/rawdevices +++ b/rc.d/init.d/rawdevices @@ -13,22 +13,24 @@ [ -f /usr/bin/raw ] || exit 0 [ -f /etc/sysconfig/rawdevices ] || exit 0 # Exit if the file just has the default comments. -/bin/grep -q -v "^#" /etc/sysconfig/rawdevices 2>/dev/null || exit 0 +LC_ALL=C /bin/egrep -q -v "^ *#" /etc/sysconfig/rawdevices 2>/dev/null || exit 0 . /etc/init.d/functions function assign_raw() { - cat /etc/sysconfig/rawdevices | egrep -v '^ *#' | while read RAW BLOCK; do + LC_ALL=C egrep -v '^ *#' /etc/sysconfig/rawdevices | + while read RAW BLOCK; do if [ -n "$RAW" -a -n "$BLOCK" ]; then - if [ "`dirname $RAW`" = "/dev" -a -d /dev/raw ]; then + rawdirname=${RAW%/*} + if [ "$rawdirname" = "/dev" -a -d /dev/raw ]; then echo $" Please correct your /etc/sysconfig/rawdevices:" echo $" rawdevices are now located in the directory /dev/raw/ " echo $" If the command 'raw' still refers to /dev/raw as a file." echo $" you'll have to upgrade your util-linux package" exit 0 fi - if [ "`dirname $RAW`" = "/dev/raw" -a -f /dev/raw ]; then + if [ "$rawdirname" = "/dev/raw" -a -f /dev/raw ]; then echo $" Please correct your /etc/sysconfig/rawdevices:" echo $" rawdevices are now located in the directory /dev/raw/ " echo $" If the command 'raw' still refers to /dev/raw as a file." -- cgit v1.2.1