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

Goo*_*ogi 3 bash curl environment-variables http-headers

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

curl --location --request POST 'test.example.com' \
--header 'Content-Type: application/json' \
--header 'access_token: "${SOME_ENV_TOKEN}"' \
--header 'Authorization: Basic Og=='
Run Code Online (Sandbox Code Playgroud)

不工作。

1N4*_*001 5

使用--header "access_token: \"${SOME_ENV_TOKEN}\""

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