Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Bash 如何在curl的请求头中设置环境变量?_Bash_Curl_Http Headers_Environment Variables - Fatal编程技术网

Bash 如何在curl的请求头中设置环境变量?

Bash 如何在curl的请求头中设置环境变量?,bash,curl,http-headers,environment-variables,Bash,Curl,Http Headers,Environment Variables,如何在curl的请求头中设置环境变量 curl --location --request POST 'test.example.com' \ --header 'Content-Type: application/json' \ --header 'access_token: "${SOME_ENV_TOKEN}"' \ --header 'Authorization: Basic Og==' 不工作。使用--header“access\u token:\”${SOME\u

如何在curl的请求头中设置环境变量

curl --location --request POST 'test.example.com' \
--header 'Content-Type: application/json' \
--header 'access_token: "${SOME_ENV_TOKEN}"' \
--header 'Authorization: Basic Og=='
不工作。

使用
--header“access\u token:\”${SOME\u ENV\u token}\”

引号禁用了sh中的变量扩展。

--标题“access\u token:${SOME\u ENV\u token}”确实有效。谢谢