netcardconfig: don't fail with bash >=4.4 when scanning for networks
authorMichael Prokop <mika@grml.org>
Sat, 25 Mar 2017 15:24:40 +0000 (16:24 +0100)
committerMichael Prokop <mika@grml.org>
Sat, 25 Mar 2017 15:30:24 +0000 (16:30 +0100)
There was a behavior change in bash 4.4:

| % bash --version | head -1
| GNU bash, version 4.3.30(1)-release (x86_64-pc-linux-gnu)
| % cat foo
| printf "1\n2\n3\n" > /tmp/input
| i=0
| while read line
| do
| WARRAY[i++]=$line
| done < /tmp/input
| echo ${WARRAY[@] }
| % bash ./foo
| 1 2 3
| %
|
| % bash --version | head -1
| GNU bash, version 4.4.5(1)-release (x86_64-pc-linux-gnu)
| % bash ./foo
| ./foo: line 7: ${WARRAY[@] }: bad substitution
| %

While at it don't hide empty and hidden ESSIDs, this is breaking
the dialog option parsing, so while it's not really nice from
a user perspective it's still better than a failing netcardconfig.

Closes grml/release-planning#13 @ GH

sbin/netcardconfig

index 52a1c6a..c9dd5a9 100755 (executable)
@@ -157,9 +157,6 @@ scanwlan(){
   iwlist $DV scanning | grep "ESSID\|Quality" | sed -e "s/^.*ESSID:\"\|\"$//g" | tac > "$TMP"
   while read line
   do
-    # don't show up empty and hidden (containing "\x00") ESSIDs
-    echo $line | grep -q \\x00 && continue
-    [ -z "$line" ] && continue
     WARRAY[i++]=$line
   done < "$TMP"
   unset i
@@ -264,7 +261,7 @@ configiface() {
       while [ $RESCAN -eq 1 ]
       do
         scanwlan
-        $DIALOG --extra-button --extra-label "Rescan" --menu "$MESSAGEWSCAN2" 20 70 15 "${WARRAY[@] }" 2>"$TMP"
+        $DIALOG --extra-button --extra-label "Rescan" --menu "$MESSAGEWSCAN2" 20 70 15 "${WARRAY[@]}" 2>"$TMP"
         case $? in
           0)
             RESCAN=0