netcardconfig: don't fail with bash >=4.4 when scanning for networks
[grml-network.git] / sbin / netcardconfig
index 7124b53..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
@@ -573,7 +570,7 @@ while read dev mac; do
   fi
 #echo "Made to ${NETDEVICES[$NETDEVICESCOUNT]}"
   ((NETDEVICESCOUNT++))
-done < <(ifconfig -a|grep Ethernet|grep -v ^vmnet|awk '! /^\s/{print $1" "$5}')
+done < <(ip link show | awk ' !/^\s/{sub(/:/,"",$2);IFACE=$2} /link.ether/{if (IFACE !~/^vmnet/) print IFACE" "$2}')
 for dev in $LAN; do
   if [ "$(ethtool -i $dev 2>/dev/null|awk '/^bus-info:/{print $2}')" == "ieee1394" ]; then
     isauto="0"