Fixed problem with dig not always giving correct output

This commit is contained in:
9cco 2022-02-19 12:35:53 +01:00
parent e8873cc328
commit ff6a8df63c
1 changed files with 2 additions and 1 deletions

View File

@ -21,7 +21,8 @@ command -v dig &> /dev/null
# Use the DNS lookup if dig is available. # Use the DNS lookup if dig is available.
if [[ $? -eq 0 ]]; then if [[ $? -eq 0 ]]; then
ip=$(dig +short myip.opendns.com @resolver1.opendns.com); ip=$(dig +short myip.opendns.com @resolver1.opendns.com);
else fi
if [[ $ip -eq "" ]]; then
ip=$(curl -s https://api.ipify.org || curl -s https://ipv4.icanhazip.com/) ip=$(curl -s https://api.ipify.org || curl -s https://ipv4.icanhazip.com/)
fi fi