bash脚本aws cloudfront创建无效路径不正确

bash脚本aws cloudfront创建无效路径不正确,bash,git,amazon-web-services,amazon-cloudfront,Bash,Git,Amazon Web Services,Amazon Cloudfront,我是bash新手,尝试通过调用 aws cloudfront create-invalidation --distribution-id XXX --profile XXX --path /planning/index.html 在cmd中可以正常工作,但在git bash中不行。一定是一些转义字符的问题,但我不太明白它应该是什么 更新:调用CreateInvalidation操作时,错误消息Im进入bash:您的请求包含一个或多个无效无效路径 已解决:通过提供cli输入json解决 aws

我是bash新手,尝试通过调用

aws cloudfront create-invalidation --distribution-id XXX --profile XXX --path /planning/index.html
在cmd中可以正常工作,但在git bash中不行。一定是一些转义字符的问题,但我不太明白它应该是什么

更新:调用CreateInvalidation操作时,错误消息Im进入bash
:您的请求包含一个或多个无效无效路径

已解决:通过提供
cli输入json解决

aws cloudfront create-invalidation --profile $PROFILE --cli-input-json "{\"DistributionId\":\"MY_DISTRIBUTION_ID\",\"InvalidationBatch\":{\"Paths\":{\"Quantity\":1,\"Items\":[\"/planning/index.html\"]},\"CallerReference\":\"$(date +%s)\"}}"```

“git bash”是什么意思?我在windows上工作,所以在执行脚本时,我试图通过传递
--路径”/\planning/\index.html“
来转义斜杠字符,但它被解析为
”//planning/index.html“
斜杠在shell中不是一个特殊字符。就Bash而言,您的代码看起来不错;可能是AWS的问题。(您正在反斜杠转义
p
i
,而不是斜杠。如果注释中的代码是您实际遇到问题的代码,为什么不在问题中?)?这也可能有助于将其添加到问题中。