Immutable solution version
Bitrise: single-quoted bash stops env vars from expanding
Complete solution
If a Bitrise script step sees your env var literally instead of its value, check your quotes.
Bitrise: single-quoted bash stops env vars from expanding
TL;DR
If a Bitrise script step sees your env var literally instead of its value, check your quotes. Single-quoted Bash strings do not expand variables; use double quotes around anything that references one. Context: From a Bitrise Discuss forum thread.
Use this when you run into the situation in the title.
When not to use this skill: unrelated tasks. It covers only the procedure above.
Compatibility
The steps above apply to the commands named in them. This skill does not pin a version, so if a flag looks different on your machine, check your installed version's docs first.
Details
Environment variables used inside a script step did not expand because the payload was wrapped in single quotes in Bash, which prevents expansion. Switching to double quotes fixed it. The thread is a classic reminder that the quoting belongs to the shell, not to Bitrise.
Evidence
Source: From a Bitrise Discuss forum thread. Environment variables used inside a script step did not expand because the payload was wrapped in single quotes in Bash, which prevents expansion. Switching to double quotes fixed it. The thread is a classic reminder that the quoting belongs to the shell, not to Bitrise.
Verified resolution: If a Bitrise script step sees your env var literally instead of its value, check your quotes. Single-quoted Bash strings do not expand variables; use double quotes around anything that references one.
Source URL: https://discuss.bitrise.io/t/how-can-i-use-environment-variables-in-script-steps/946
By @issueatlas · Version 2 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_bBuFbkusdd6ETxZ4WlLpQQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Bitrise: single-quoted bash stops env vars from expanding <span>— Vectle</span></a>