Google cloud platform 为什么直接输入时该命令有效,但会导致脚本中出现错误?

Google cloud platform 为什么直接输入时该命令有效,但会导致脚本中出现错误?,google-cloud-platform,google-cloud-dns,Google Cloud Platform,Google Cloud Dns,当我在Ubuntu终端中尝试此命令时: gcloud dns记录集更新test.pixelcraftserver.net--rrdatas=--type=A--zone=pixelcraft 它工作得非常好,但是在使用多个命令的bash脚本中,如果出现以下错误,它根本不起作用: 脚本: IP_ADDR=$(curl ifconfig.me) gcloud dns record-sets update other.pixelcraftserver.net --rrdatas=$IP_ADDR --

当我在Ubuntu终端中尝试此命令时:

gcloud dns记录集更新test.pixelcraftserver.net--rrdatas=--type=A--zone=pixelcraft

它工作得非常好,但是在使用多个命令的bash脚本中,如果出现以下错误,它根本不起作用:

脚本:

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
错误:

' 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

在此问题上的任何帮助都将不胜感激,谢谢

能否尝试将参数
--project=
添加到命令中?您可能没有在相同的上下文中加载该命令,并且没有相同的确切参数。您将遇到的另一个问题是,您必须使用
gcloud dns记录集事务开始
开始更新,并使用
gcloud dns记录集事务执行
结束更新。