我正在尝试运行aws创建lambda函数。它是这样的-
eval $(aws lambda create-function \
--function-name $FUNCTION_NAME \
--runtime $RUNTIME \
--role $ROLE \
--handler $HANDLER \
--region $REGION \
--zip-file $ZIP_FILE \
--profile $PROFILE \
--environment $env_variables)所有变量都来自命令行。对于env_variables来说,这是失败的。它被构造成-
env_variables="Variables={INPUT=${DAYS}}"天实际上是"20 days"的地方
我如何避免这个空间并成功地传递我的命令。
发布于 2017-11-04 14:40:47
最后,在工作之后-
env_variables="\"Variables\":{\"INPUT\":\"${DAYS}\"}"
lambda_create_command="aws lambda create-function --function-name $FUNCTION_NAME --runtime $RUNTIME --role $ROLE --handler $HANDLER --region $REGION --zip-file $ZIP_FILE --profile $PROFILE --environment '$env_variables'"
echo "Executing command : $lambda_create_command"
eval $lambda_create_command重要的一点-
env_variables中的引号eval的使用$env_variables )中的单引号参考- https://gist.github.com/andywirv/f312d561c9702522f6d4ede1fe2750bd
完整工作代码:https://gist.github.com/aniket91/19492b32f570ece202718153661b1823
发布于 2017-11-04 13:22:37
该值需要用引号包装,请尝试如下:
env_variables="Variables=\"{INPUT=${DAYS}}\""https://stackoverflow.com/questions/47111075
复制相似问题