diff --git a/wireguard-inject.sh b/wireguard-inject.sh index 5069d05..3121dfd 100755 --- a/wireguard-inject.sh +++ b/wireguard-inject.sh @@ -57,7 +57,6 @@ declare -A interfaces declare -A previous_modtimes declare -A add_interfaces declare -A remove_interfaces -modcount=0 if [ -f "$MODFILE" ] then @@ -87,8 +86,6 @@ do # if an interface has been modified, remove it then re-add it remove_interfaces[$iface]=1 add_interfaces[$iface]=1 - - modcount=$(( modcount + 1 )) done ########################################################################### @@ -147,7 +144,8 @@ done # all done # save the modified times if required -if [ "$modcount" -gt 0 ] +if [ "${#add_interfaces[@]}" -gt 0 ] || + [ "${#remove_interfaces[@]}" -gt 0 ] then exec 3> "$MODFILE" for file in "${!modtimes[@]}"