我使用Cygwin来运行我的CURL命令。
$ curl http://URL/update.json --connect-timeout 10000 --max-time 10000 --data-binary @bars.json -H 'Content-type:application/json;charset=utf-8;X-Vendor-Email=myemaiL@gmail.com;'
{"uploaded":true,"message":"Bars JSON received. A email will be sent after processing has completed."}
正如您所看到的,它工作正常并且可以很好地上传到远程服务器。我试图通过将其放入脚本文件来自动化这种声明。
我的脚本文件:
cd /cygdrive/x
curl http://URL/update.json --connect-timeout 10000 --max-time 10000 --data-binary @bars.json -H 'Content-type:application/json;charset=utf-8;X-Vendor-Email=EMAIL@gmail.com;
错误:
$ /bin/test.sh
: No such file or directorycygdrive/x
/bin/test.sh: line 2: unexpected EOF while looking for matching `''
/bin/test.sh: line 3: syntax error: unexpected end of file
答案 0 :(得分:1)
您需要在命令末尾添加结束'
。
curl http://URL/update.json --connect-timeout 10000 --max-time 10000 \
--data-binary @bars.json \
-H 'Content-type:application/json;charset=utf-8;X-Vendor-Email=EMAIL@gmail.com'