[PATCH 11/48] Replace if statement with parameter expansion.

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



${foo:+-p ${foo}} expands to nothing if foo is not set, -p $foo if foo is set.
---
 functions |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/functions b/functions
index 8aaee68..56c6a7b 100644
--- a/functions
+++ b/functions
@@ -262,11 +262,8 @@ set_consolefont() {
     #CONSOLEMAP in UTF-8 shouldn't be used
     [[ $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
-	else
-	    /usr/bin/setfont $CONSOLEFONT -C ${i} >/dev/null 2>&1
-	fi
+	/usr/bin/setfont ${CONSOLEMAP:+-m ${CONSOLEMAP}} \
+	    $CONSOLEFONT -C ${i} >/dev/null 2>&1
     done
     if [ $? -ne 0 ]; then
 	stat_fail
-- 
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