svn commit: r309952 - head/usr.sbin/bsdinstall/scripts

Devin Teske dteske at FreeBSD.org
Mon Dec 12 21:29:50 UTC 2016


Author: dteske
Date: Mon Dec 12 21:29:48 2016
New Revision: 309952
URL: https://svnweb.freebsd.org/changeset/base/309952

Log:
  In awk, casting a variable as a boolean condition is the same as testing if
  the length of the variable contents is greater than zero
  
  This allows us to also move the secondary condition into the action clause

Modified:
  head/usr.sbin/bsdinstall/scripts/wlanconfig

Modified: head/usr.sbin/bsdinstall/scripts/wlanconfig
==============================================================================
--- head/usr.sbin/bsdinstall/scripts/wlanconfig	Mon Dec 12 21:27:29 2016	(r309951)
+++ head/usr.sbin/bsdinstall/scripts/wlanconfig	Mon Dec 12 21:29:48 2016	(r309952)
@@ -213,10 +213,7 @@ while :; do
 
 	SCAN_RESULTS=$( wpa_cli scan_results )
 	NETWORKS=$( echo "$SCAN_RESULTS" | awk -F '\t' '
-		/..:..:..:..:..:../ {
-			if (length($5) > 0)
-				printf("\"%s\"\t%s\n", $5, $4)
-		}
+		/..:..:..:..:..:../ && $5 { printf("\"%s\"\t%s\n", $5, $4) }
 	' | sort | uniq )
 
 	if [ ! "$NETWORKS" ]; then


More information about the svn-src-head mailing list