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
This commit is contained in:
Devin Teske 2016-12-12 21:29:48 +00:00
parent 275c0c0741
commit 6c26775c2f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=309952

View File

@ -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