Fix issue with grep matching on substring

This commit is contained in:
Johan Thorén 2024-05-04 21:21:27 +02:00 committed by GitHub
parent 9efa485717
commit e73aebaeb2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -68,7 +68,7 @@ fi
wrtt=$(printf "%0.3f" "$wrtt") wrtt=$(printf "%0.3f" "$wrtt")
crtt=$(printf "%0.3f" "$crtt") 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 if [ -z "$STAT" ]; then
echo -n "Gateway with name '${gwname}' does not exist, possible values are: " echo -n "Gateway with name '${gwname}' does not exist, possible values are: "
listgw | xargs listgw | xargs