From 4db6582f5883d684fd316211faf5af58f9a79729 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Mon, 1 Apr 2019 09:11:03 +0200 Subject: update-ddns.in: more style updates --- update-ddns.in | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/update-ddns.in b/update-ddns.in index 72e89a7..7aef624 100644 --- a/update-ddns.in +++ b/update-ddns.in @@ -99,9 +99,9 @@ for dnsName in $( \ updateUrl="${updateUrls[${j}]}" if [[ "${dnsName}" == *'/'* ]]; then - dnsIps="$( + dnsIps=$( curl ${ipCmdVers[${j}]} "${dnsName}" 2> /dev/null - )" + ) ips='1' updateIps="${updateIps}"',auto' if [ -n "${curlForceIpVer}" ] && [ "${curlForceIpVer}" != "${ipCmdVers[${j}]}" ]; then @@ -110,27 +110,26 @@ for dnsName in $( \ fi curlForceIpVer="${ipCmdVers[${j}]}" else - dnsIps="$( + dnsIps=$( dig $1 "${dnsName}" ${dnsVers[${j}]} | \ sed '/^;; AUTHORITY SECTION:$/Q' | \ grep '^[^;]' | \ grep "\s${dnsVers[${j}]}\s" | \ awk '{print $5}' | \ sort -u - )" + ) - ips="$( + ips=$( "${ipCmd}" -o ${ipCmdVers[${j}]} addr show scope global | \ awk '{print $4}' | \ cut -d/ -f1 | \ grep -vx "${ignoreIps}" | \ sort -u - )" + ) if [ $(echo "${ips}" | grep -c '.') -eq 0 ]; then updateIps="${updateIps}"',auto' - if [ -n "${curlForceIpVer}" ] && [ "${curlForceIpVer}" != "${ipCmdVers[${j}]}" ] - then + if [ -n "${curlForceIpVer}" ] && [ "${curlForceIpVer}" != "${ipCmdVers[${j}]}" ]; then >&2 echo 'Error: I cannot determine two different ip versions automatically (because Erich didn'"'"'t need it).' exit 1 fi -- cgit v1.2.3-70-g09d2