我有卷曲命令:
curl -u ${USER_ID}:${PASSWORD} -X GET 'http://lppma670.gso.aexp.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://lppma670.gso.aexp.com:8080/rest/job-execution/job-details/1160'
有人可以帮我吗我想要在curl命令中传递变量的值.
在
shell中使用变量时,只能使用双引号,而不是单引号:单引号中的变量不会展开.
了解’和’和`之间的区别,见 http://mywiki.wooledge.org/Quotes和 http://wiki.bash-hackers.org/syntax/words
了解’和’和`之间的区别,见 http://mywiki.wooledge.org/Quotes和 http://wiki.bash-hackers.org/syntax/words