Bash-INWX-DynDNS icon indicating copy to clipboard operation
Bash-INWX-DynDNS copied to clipboard

Error in for loop

Open madman9999 opened this issue 4 years ago • 3 comments
trafficstars

There is an error when you have more than one domain (DNSIDsv4) )to be updated. Only the first ID will be updated, all other will be ignored, because the variable old.ipv4 is updated inside the "for loop", which causes that in the next loop the old.ipv4==new.ipv4.

So please remove line 133 (echo $NEWIPv4 > old.ipv4). I think the same apply for IPv6, but I don't use it.

I put at the end of the script the following lines and it works like this:

if [ ! "$OLDIPv4" == "$NEWIPv4" ]; then echo $NEWIPv4 > old.ipv4 log "IP Address updated to $NEWIPv4" log "###################################################" fi

madman9999 avatar Feb 03 '21 08:02 madman9999

I can confirm: Issue still exists, second IDs won't be updated. You should adapt your script, maybe in the way madman9999 suggested.

alfschauer avatar Oct 25 '21 08:10 alfschauer

There are now three solutions to this problem, see #23, #25 and #28

Strubbl avatar Oct 29 '21 21:10 Strubbl

I merged #28, so this should fix the issue?

gehaxelt avatar Feb 24 '22 09:02 gehaxelt