[英]How to escape curly bracket in AWS CLI Bash
我正在嘗試使用AWS CLI Lambda替換環境變量。 但是,即使我已經將整個內容放在單引號中,我要替換的值中也帶有一對花括號,並且CLI抱怨json格式。 這是我的命令:
aws lambda update-function-configuration --function-name myFunc --environment Variables={URL='http://example.com/api/{0}'}
這是錯誤:
Error parsing parameter '--environment': Expected: ',', received: '}' for input:
有趣的是,如果我刪除了右括號}
,它會起作用:
aws lambda update-function-configuration --function-name myFunc --environment Variables={URL='http://example.com/api/{0'}
請幫忙!!!
用雙引號引起來:
Variables="{URL='http://example.com/api/{0}'}"
aws lambda update-function-configuration --function-name myFunc --environment Variables="{URL='http://example.com/api/{0}'}"
調用UpdateFunctionConfiguration操作時發生錯誤(ResourceNotFoundException):找不到函數:arn:aws:lambda:us-west-1:1234567890:function:myFunc
aws lambda update-function-configuration --function-name myFunc --environment "Variables={URL='http://example.com/api/{0}'}"
這是有關aws cli中雙引號的詳細問題https://github.com/aws/aws-cli/issues/2638
這有效,但是我的命令卻不同。
aws apigateway update-resource \
--rest-api-id <rest_api_id> \
--resource-id <resource_id> \
--patch-operations 'op=replace,path=/pathPart,value="{something}"'
這些要點是:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.