From e73aebaeb23ca0e466919489fd0530058dbab222 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Thor=C3=A9n?= Date: Sat, 4 May 2024 21:21:27 +0200 Subject: [PATCH] Fix issue with grep matching on substring --- check_pf_gw_status | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check_pf_gw_status b/check_pf_gw_status index f62a42b..6a1f0b5 100644 --- a/check_pf_gw_status +++ b/check_pf_gw_status @@ -68,7 +68,7 @@ fi wrtt=$(printf "%0.3f" "$wrtt") crtt=$(printf "%0.3f" "$crtt") -STAT=$($GWSTATUSCMD | grep $gwname | sed -E -e 's/[[:blank:]]+/,/g' -e 's/ms//g' -e 's/%//g') +STAT=$($GWSTATUSCMD | grep "^${gwname}\s" | sed -E -e 's/[[:blank:]]+/,/g' -e 's/ms//g' -e 's/%//g') if [ -z "$STAT" ]; then echo -n "Gateway with name '${gwname}' does not exist, possible values are: " listgw | xargs