Why does this command work when inputted directly, but results in an error within a script?

482 Views Asked by At

When I try this command in Ubuntu Terminal:

gcloud dns record-sets update test.pixelcraftserver.net --rrdatas=<MyIPAddress> --type=A --zone=pixelcraft

It works perfectly fine, however in a bash script using multiple commands, it doesn't work at all giving this error:

Script:

IP_ADDR=$(curl ifconfig.me)
gcloud dns record-sets update other.pixelcraftserver.net --rrdatas=$IP_ADDR --type=A --zone=pixelcraft
gcloud dns record-sets update test.pixelcraftserver.net --rrdatas=$IP_ADDR --type=A --zone=pixelcraft
gcloud dns record-sets update main.pixelcraftserver.net --rrdatas=$IP_ADDR --type=A --zone=pixelcraft

Error:

' does not exist.s.record-sets.update) HTTPError 404: The 'parameters.managedZone' resource named 'pixelcraft
' does not exist.s.record-sets.update) HTTPError 404: The 'parameters.managedZone' resource named 'pixelcraft
' does not exist.s.record-sets.update) HTTPError 404: The 'parameters.managedZone' resource named 'pixelcraft

Any help on this matter would be appreciated, thanks!

0

There are 0 best solutions below