From 928616e9e086a5e7a62f0d54561c641219cc6837 Mon Sep 17 00:00:00 2001 From: Harald Ringvold Date: Sat, 20 Mar 2021 21:14:24 +0100 Subject: [PATCH] Fix IP check for the case where all services fail Last commit would still not fix the problem if all services fails because of the check on line 38. --- dyndns.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dyndns.sh b/dyndns.sh index f17a281..325658a 100755 --- a/dyndns.sh +++ b/dyndns.sh @@ -29,9 +29,8 @@ while ( true ); do for service in ${services[@]}; do echo "Trying with $service..." - ip="$(curl -s $service)" - valid_ip=$(echo $ip | grep '[0-9]\{1,3\}\(\.[0-9]\{1,3\}\)\{3\}') - test -n "$valid_ip" && break + ip="$(curl -s $service | grep '[0-9]\{1,3\}\(\.[0-9]\{1,3\}\)\{3\}')" + test -n "$ip" && break done echo "Found IP address $ip"