我做了一个bash脚本上传的CouchDB的, 一个DB但是,这与bash的执行上传文件不能正常工作的最后一个命令,而它工作完全正常,如果我只是启动在命令行中使用相同的命令。巴什 - curl命令行执行不佳
下面是bash代码:
id="$(curl -X GET http://127.0.0.1:5984/_uuids?count=1)"
command="curl -X PUT -d ${A} http://chococo:[email protected]:5984/test/${id:11:32}"
echo "Let's try the command "
echo "${command}"
${command}
而且它类似的东西:
curl: (3) [globbing] bad range in column 2
curl: (3) [globbing] unmatched close brace/bracket in column 4
Let's try the command
curl -X PUT -d '{"evaluation": "none"}' http://chococo:[email protected]:5984/test/2d7811268e98b62d91be1e7cd028e021
curl: (3) [globbing] unmatched brace in column 1
curl: (6) Could not resolve host: "evaluation",
curl: (6) Could not resolve host: "none"
如果我在命令行中执行相同的命令,它的伟大工程
curl -X PUT -d '{"evaluation": "none"}' http://chococo:[email protected]:5984/test/2d7811268e98b62d91be1e7cd028e021
这里有什么错误?
你并不需要在变量名的括号,你是不是间接执行命令而是引用内容等:A =“{‘评价’:‘无’}”,然后参考用“$ A” –
非常感谢您的回答拉曼,但它虽然给出了相同的结果;我仍然有同样的问题 – Chococo35