From b46ae0aa324a8374459ab4f9cf53ea5d11481739 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Apr 03 2013 20:02:17 +0000 Subject: setregdomain: remove sed and awk calls --- diff --git a/setregdomain b/setregdomain index 7664c59..2a0cee0 100755 --- a/setregdomain +++ b/setregdomain @@ -31,7 +31,8 @@ fi if [ -f $TZ ] then - ZONE=$(readlink $LOCALTIME | sed -e 's/\/usr\/share\/zoneinfo\///') + ZONE=$(readlink $LOCALTIME) + ZONE=${ZONE#/usr/share/zoneinfo/} else echo "Timezone information not found! Unable to set regulatory domain." exit @@ -43,7 +44,7 @@ then exit fi -COUNTRY=$(grep $ZONE /usr/share/zoneinfo/zone.tab | awk '{ print $1 }') +COUNTRY=$(while read c a z r; do if [ "$z" = "$ZONE" ]; then echo $c; break; fi ;done < /usr/share/zoneinfo/zone.tab) if [ -z "$COUNTRY" ] then