[PATCH 10/48] Replace trivial use of grep with bash regex conditional.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Bash has regex support, and it allows us to replace most trivial
uses of sed, grep, and awk.  The fewer processes we create, the faster
we go, and every little bit helps.

I also think it is more readable to use a bash regex for the trivial stuff.
---
 functions |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/functions b/functions
index f954737..8aaee68 100644
--- a/functions
+++ b/functions
@@ -260,9 +260,7 @@ set_consolefont() {
     [[ $CONSOLEFONT ]] || return 0
     stat_busy "Loading Console Font: $CONSOLEFONT"
     #CONSOLEMAP in UTF-8 shouldn't be used
-    if [ -n "$CONSOLEMAP" ] && echo "$LOCALE" | /bin/grep -qi utf ; then
-	CONSOLEMAP=""
-    fi
+    [[ $CONSOLEMAP && $LOCALE =~ UTF|utf ]] && CONSOLEMAP=""
     for i in /dev/tty[0-9]*; do
 	if [ -n "$CONSOLEMAP" ]; then
 	    /usr/bin/setfont -m $CONSOLEMAP $CONSOLEFONT -C ${i} >/dev/null 2>&1
-- 
1.7.1



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux