Commit 1da7ed29 authored by Jouke Witteveen's avatar Jouke Witteveen
Browse files

Improve handling of empty SSIDs in wifi-menu

The sed alternative to the grep/substring combination would be

    sed -n 's/ssid=//p;T_;q0;:_;$q1'

which is as beautiful as it is unreadable.
parent 17cbd88d
......@@ -75,7 +75,7 @@ init_entries() {
else
ENTRIES[i]=" " # Not present
fi
if [[ "$ssid" = "$CONNECTION" ]]; then
if is_yes "${CONNECTED:-no}" && [[ "$ssid" = "$CONNECTION" ]]; then
ENTRIES[i]="*" # Currently connected
fi
if [[ "$flags" =~ WPA2|WPA|WEP ]]; then
......@@ -246,7 +246,10 @@ if [[ "$RFKill" && "$(rf_status "$INTERFACE" "$RFKill")" ]]; then
fi
echo -n "Scanning for networks... "
CONNECTION=$(wpa_call "$INTERFACE" status 2> /dev/null | sed -n "s/^ssid=//p")
if CONNECTION=$(wpa_call "$INTERFACE" status 2> /dev/null | grep -m 1 "^ssid="); then
CONNECTION=${CONNECTION#ssid=}
CONNECTED=yes
fi
NETWORKS=$(wpa_supplicant_scan "$INTERFACE" 3,4,5)
RETURN=$?
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment