我有一个curl命令:
curl -u ${USER_ID}:${PASSWORD} -X GET 'http://blah.gso.woo.com:8080/rest/job-execution/job-details/${job_id}'
变量job_id
其中有一个值,例如 1160。当我在 shell 中执行curl命令时,它给出以下错误:
{"message":"Sorry. An unexpected error occured.", "stacktrace":"Bad Request. The request could not be understood by the server due to malformed syntax."}
如果我直接在命令中传递数字“1160”,如下所示,curl 命令将起作用。
curl -u ${USER_ID}:${PASSWORD} -X GET 'http://blah.gso.woo.com:8080/rest/job-execution/job-details/1160'
我希望能够在curl命令中传递变量的值。
当在中使用变量时shell /questions/tagged/shell,只能使用双引号,不能使用单引号:单引号内的变量不会扩展。
了解 ' 和 " 和 ` 之间的区别。请参阅http://mywiki.wooledge.org/Quotes http://mywiki.wooledge.org/Quotes and https://web.archive.org/web/20230314111401/https://wiki.bash-hackers.org/syntax/words https://web.archive.org/web/20230314111401/https://wiki.bash-hackers.org/syntax/words
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)