summaryrefslogtreecommitdiffstats
path: root/src/wifi-menu
diff options
context:
space:
mode:
authorJouke Witteveen <j.witteveen@gmail.com>2013-07-21 00:51:34 +0200
committerJouke Witteveen <j.witteveen@gmail.com>2013-07-21 00:51:34 +0200
commitcbd00d5652700792a7833617d947f8a78bb34ccc (patch)
treef561f0d5b4ebd0ea45b02d54214d24054791d70b /src/wifi-menu
parent30ea4c009e9ba095eb6ac94655715cc9531d4594 (diff)
downloadnetctl-cbd00d5652700792a7833617d947f8a78bb34ccc.tar.gz
netctl-cbd00d5652700792a7833617d947f8a78bb34ccc.tar.xz
Introduce sed
Instead of filtering results from grep, we can also just use sed. Installations having grep can be expected to have sed as well.
Diffstat (limited to 'src/wifi-menu')
-rwxr-xr-xsrc/wifi-menu6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/wifi-menu b/src/wifi-menu
index d0903aa..a62881e 100755
--- a/src/wifi-menu
+++ b/src/wifi-menu
@@ -111,8 +111,7 @@ create_profile()
key=$(dialog $box "$msg" 10 40 --stdout) || return $?
if [[ "${#key}" -ge 8 && "${#key}" -le 63 ]]; then
if [[ "$OBSCURE" ]]; then
- key=$(wpa_passphrase "$1" "$key" | grep -m 1 "^[[:space:]]*psk=")
- key=${key#*psk=}
+ key=$(wpa_passphrase "$1" "$key" | sed -n "s/^[[:space:]]*psk=//p")
else
key=$(printf "%q" "$key")
fi
@@ -210,8 +209,7 @@ if [[ ! -d "/sys/class/net/$INTERFACE" ]]; then
fi
echo -n "Scanning for networks... "
-CONNECTION=$(wpa_call "$INTERFACE" status 2> /dev/null | grep -m 1 "^ssid=")
-CONNECTION=${CONNECTION#ssid=}
+CONNECTION=$(wpa_call "$INTERFACE" status 2> /dev/null | sed -n "s/^ssid=//p")
NETWORKS=$(wpa_supplicant_scan "$INTERFACE" 3,4,5)
if [[ $? -eq 0 ]]; then
trap 'rm -f "$NETWORKS"' EXIT