Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Dec 2016 21:29:49 +0000 (UTC)
From:      Devin Teske <dteske@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r309952 - head/usr.sbin/bsdinstall/scripts
Message-ID:  <201612122129.uBCLTnWY041731@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201612122129.uBCLTnWY041731>