mirror of
https://github.com/tunix/digitalocean-dyndns
synced 2024-12-22 12:59:52 +00:00
Adding check for valid ip address
In some cases the return body from ifconfig.co is an HTML error page. This change makes sure the response is a valid IP address.
This commit is contained in:
parent
8c940d5bd2
commit
9b59388a58
1 changed files with 2 additions and 1 deletions
|
@ -30,7 +30,8 @@ while ( true ); do
|
||||||
echo "Trying with $service..."
|
echo "Trying with $service..."
|
||||||
|
|
||||||
ip="$(curl -s $service)"
|
ip="$(curl -s $service)"
|
||||||
test -n "$ip" && break
|
valid_ip=$(echo $ip | grep '[0-9]\{1,3\}\(\.[0-9]\{1,3\}\)\{3\}')
|
||||||
|
test -n "$valid_ip" && break
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Found IP address $ip"
|
echo "Found IP address $ip"
|
||||||
|
|
Loading…
Reference in a new issue