我正在尝试制作一个执行curl命令的脚本,以使用Rest API创建Rabbit Exchange。
如果我使用--data定义如下:
HTTP_RESPONSE=$(curl --silent --write-out "HTTPSTATUS:%{http_code}" -u $USR:$PWD --header "Content-Type: application/json" --request PUT --data '{"type": "topic","auto_delete": false,"durable": true,"internal": false,"arguments": {}}' $URL_GENERATE_EXCHANGE)
它运行
但是我想从这样的变量中传递数据
EXCHANGE_DEFINITION='{"type": "topic","auto_delete": false,"durable": true,"internal": false,"arguments": {}}'
HTTP_RESPONSE=$(curl --silent --write-out "HTTPSTATUS:%{http_code}" -u $USR:$PWD --header "Content-Type: application/json" --request PUT --data $EXCHANGE_DEFINITION $URL_GENERATE_EXCHANGE)
但是它不起作用...而且我不明白为什么...。有人可以帮我吗?
谢谢