From 9f7f634933c8d9d2b47ebcca2934480b4a1d177b Mon Sep 17 00:00:00 2001 From: encrypt Date: Wed, 25 Mar 2015 02:13:51 +0100 Subject: [PATCH] s/STATE/switch_state/g --- etherswitch.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/etherswitch.sh b/etherswitch.sh index a349986..519c4c3 100755 --- a/etherswitch.sh +++ b/etherswitch.sh @@ -1,6 +1,6 @@ #!/bin/env bash -STATE=0 +switch_state=0 function check_fn { type $1 &> /dev/null || { @@ -29,18 +29,17 @@ do ip link show $device | grep -q "LOWER_UP" if [ $? -eq 1 ] then - if [ $STATE -eq 1 ] + if [ $switch_state -eq 1 ] then - STATE=0 + switch_state=0 on_switch_open fi else - if [ $STATE -eq 0 ] + if [ $switch_state -eq 0 ] then - STATE=1 + switch_state=1 on_switch_close fi fi sleep 0.3 done -