From 7e2ff917a67573ed957d57d2fd077b4c219c0d86 Mon Sep 17 00:00:00 2001 From: Jouke Witteveen Date: Tue, 3 Jul 2012 12:05:24 +0200 Subject: Better grep usage When possible, fgrep is preferred. This prevents interpreting variable search patterns as expressions. In setting the control paths, the search expression was updated to match what wpa_supplicant uses. --- src/connections/wireless | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/connections/wireless') diff --git a/src/connections/wireless b/src/connections/wireless index efcda80..143276b 100644 --- a/src/connections/wireless +++ b/src/connections/wireless @@ -25,8 +25,8 @@ wireless_up() { if [[ "$SECURITY" = "wpa-config" ]]; then WPA_CONF="${WPA_CONF:-/etc/wpa_supplicant.conf}" # Use defined control path (FS#24949) - if grep "^ *ctrl_interface=" "$WPA_CONF" &>/dev/null; then - WPA_CTRL_PATH=$(grep -m 1 "^ *ctrl_interface=" "$WPA_CONF" | tail -n 1 | cut -d= -f 2- | sed -r 's/DIR=(.*) +GROUP=.*/\1/') + if grep -q "^ *ctrl_interface=" "$WPA_CONF"; then + WPA_CTRL_PATH=$(grep -m 1 "^ *ctrl_interface=" "$WPA_CONF" | cut -d= -f 2- | sed -r 's/^DIR=(.*) GROUP=.*/\1/') fi else WPA_CONF=$(make_wpa_config_file $INTERFACE) -- cgit v1.2.3-24-g4f1b