diff options
author | Jim Pryor <profjim@jimpryor.net> | 2009-08-11 14:04:59 +0200 |
---|---|---|
committer | James Rayner <james@archlinux.org> | 2009-08-15 04:28:27 +0200 |
commit | 59ddddaac272ad7fa9d53dad4f744e49a253c856 (patch) | |
tree | f8487409fb84adb38deff5dee641e0fd2ad7a9cc | |
parent | 2b98cb24c8cfdfa08d2f764e90861e82a37c0d36 (diff) | |
download | netctl-59ddddaac272ad7fa9d53dad4f744e49a253c856.tar.gz netctl-59ddddaac272ad7fa9d53dad4f744e49a253c856.tar.xz |
grep tweaks
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
-rw-r--r-- | src/8021x | 4 | ||||
-rw-r--r-- | src/connections/ethernet | 6 | ||||
-rw-r--r-- | src/connections/ethernet-iproute | 6 | ||||
-rw-r--r-- | src/connections/wireless | 4 | ||||
-rw-r--r-- | src/wireless | 2 |
5 files changed, 11 insertions, 11 deletions
@@ -7,9 +7,9 @@ wpa_check() while [[ $timeout -lt $TIMEOUT ]]; do ( # Sometimes wpa_supplicant isn't ready so silence errors for 2s only to avoid hiding real errors if [[ $timeout -lt 2 ]]; then - eval $(wpa_cli -i "$INTERFACE" status 2> /dev/null | grep wpa_state) + eval $(wpa_cli -i "$INTERFACE" status 2> /dev/null | fgrep "wpa_state=") else - eval $(wpa_cli -i "$INTERFACE" status | grep wpa_state) + eval $(wpa_cli -i "$INTERFACE" status | fgrep "wpa_state=") fi [[ "$wpa_state" = "COMPLETED" ]] ) && return 0 diff --git a/src/connections/ethernet b/src/connections/ethernet index 61e3960..08093a5 100644 --- a/src/connections/ethernet +++ b/src/connections/ethernet @@ -5,7 +5,7 @@ ethernet_up() { load_profile $1 if [[ ! -e /sys/class/net/"$INTERFACE" ]]; then - if ! echo "$INTERFACE"|grep ":"; then + if ! echo "$INTERFACE"| fgrep ":"; then report_fail "interface $INTERFACE does not exist" return 1 fi @@ -14,7 +14,7 @@ ethernet_up() { report_debug ethernet_up ifup set_interface up $INTERFACE - if ip link show $INTERFACE|grep -q "NO-CARRIER"; then + if ip link show $INTERFACE| fgrep -q "NO-CARRIER"; then report_fail "No connection" return 1 fi @@ -140,7 +140,7 @@ ethernet_down() { # Returns status of profile - is it still functional? ethernet_status() { - if ! ip link show dev ra0|grep -q "state UP"; then + if ! ip link show dev ra0 | fgrep -q "state UP"; then return 1 fi } diff --git a/src/connections/ethernet-iproute b/src/connections/ethernet-iproute index 6264497..8937f16 100644 --- a/src/connections/ethernet-iproute +++ b/src/connections/ethernet-iproute @@ -13,7 +13,7 @@ ethernet_up() { load_profile $1 if [[ ! -e /sys/class/net/$INTERFACE ]]; then - if ! echo "$INTERFACE"|grep ":"; then + if ! echo "$INTERFACE" | fgrep -q ":"; then report_iproute "Interface $INTERFACE does not exist" fi fi @@ -21,7 +21,7 @@ ethernet_up() { report_debug ethernet_iproute_up ifup set_interface up $INTERFACE - if ip link show $INTERFACE|grep -Fq "NO-CARRIER"; then + if ip link show $INTERFACE | fgrep -q "NO-CARRIER"; then report_fail "No connection" return 1 fi @@ -126,7 +126,7 @@ ethernet_down() { # Returns status of profile - is it still functional? ethernet_status() { - if ! ip link show dev ra0|grep -q "state UP"; then + if ! ip link show dev ra0 | fgrep -q "state UP"; then return 1 fi } diff --git a/src/connections/wireless b/src/connections/wireless index f905756..644b002 100644 --- a/src/connections/wireless +++ b/src/connections/wireless @@ -32,7 +32,7 @@ wireless_up() { # Check if interface exists if [[ ! -e /sys/class/net/"$INTERFACE" ]]; then - if ! echo "$INTERFACE"|grep -Fq ":"; then + if ! echo "$INTERFACE" | fgrep -q ":"; then report_fail "interface $INTERFACE does not exist" return 1 fi @@ -190,7 +190,7 @@ wireless_status() { load_profile $1 if [[ "$(iwgetid -r)" -ne $ESSID ]]; then return 1 - elif ! ip link show dev ra0|grep -q "state UP"; then + elif ! ip link show dev ra0 | fgrep -q "state UP"; then return 1 fi diff --git a/src/wireless b/src/wireless index f45028e..69d3de9 100644 --- a/src/wireless +++ b/src/wireless @@ -84,7 +84,7 @@ list_networks() let try=0; RETRIES=6; while [[ $try -ne $RETRIES ]]; do - iwlist $1 scan 2> /dev/null|grep ESSID|sed 's/.*ESSID:"\([^"]\+\)".*/\1/' > $essids + iwlist $1 scan 2> /dev/null | fgrep ESSID | sed 's/.*ESSID:"\([^"]\+\)".*/\1/' > $essids sleep 0.5; let try++ done sort -u $essids -o $essids |