From 6c26775c2faa10b67337a2a6d77ec007e7910931 Mon Sep 17 00:00:00 2001 From: Devin Teske Date: Mon, 12 Dec 2016 21:29:48 +0000 Subject: [PATCH] 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 --- usr.sbin/bsdinstall/scripts/wlanconfig | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/usr.sbin/bsdinstall/scripts/wlanconfig b/usr.sbin/bsdinstall/scripts/wlanconfig index 2239388bcbf8..cde3c901bca7 100755 --- a/usr.sbin/bsdinstall/scripts/wlanconfig +++ b/usr.sbin/bsdinstall/scripts/wlanconfig @@ -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