Why environment variable substitution does not work in bash in this case?Why is setting a variable before a...
Appropriate conduit for several data cables underground over 300' run
When do flights get cancelled due to fog?
Why did Dumbledore ignore this line?
No Torah = Revert to Nothingness?
Was it ever illegal to name a pig "Napoleon" in France?
What could cause the sea level to massively decrease?
Is it possible for a character at any level to cast all 44 Cantrips in one week without Magic Items?
Run Bash scripts in folder all at the same time
Computer name naming convention for security
Users forgetting to regenerate PDF before sending it
Why AI became applicable only after Nvidia's chips were available?
Conditions for Roots of a quadratic equation at infinity
QR codes, do people use them?
Is it okay to use open source code to do an interview task?
Hail hit my roof. Do I need to replace it?
Writing an ace/aro character?
Category-theoretic treatment of diffs, patches and merging?
Non-Chromatic Orchestral Instruments?
Optimization models for portfolio optimization
What are the effects of abstaining from eating a certain flavor?
Number of states in taxi environment (Dietterich 2000)
Why did Old English lose both thorn and eth?
Moving millions of files to a different directory with specfic name patterns
US citizen traveling with Peruvian passport
Why environment variable substitution does not work in bash in this case?
Why is setting a variable before a command legal in bash?Why doesn't bash expand this variable when I prefix a command with a “one time variable assignment”Set Variable Environment Variables in bash (or other)Environment variable set but not respectedWhy doesn't source work when I call bash -cWhy does BASH process substitution not work with some commands?Bash - Shell variable gets promoted to environment variable in child bash processWhy doesn't bash expand this variable when I prefix a command with a “one time variable assignment”Why is this environment variable not set up?Why does filename expansion not work in this example?Why does FOO=bar; export the variable into my environmentWhy doesn't pattern substitution work from a single variable?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I am trying to set the ENV variable just for the scope of this command
ENV=dev echo terraform plan -state=$ENV.tfstate -var-file=$ENV.tfvars -out=$ENV.plan
the output is for some reason:
terraform plan -state=.tfstate -var-file=.tfvars -out=.plan
Why is it?
I am using bash in osx mojave
bash osx
add a comment |
I am trying to set the ENV variable just for the scope of this command
ENV=dev echo terraform plan -state=$ENV.tfstate -var-file=$ENV.tfvars -out=$ENV.plan
the output is for some reason:
terraform plan -state=.tfstate -var-file=.tfvars -out=.plan
Why is it?
I am using bash in osx mojave
bash osx
$ENVis expanded by the shell before callingecho- see the answers at Why is setting a variable before a command legal in bash?
– steeldriver
7 mins ago
Possible duplicate of Why doesn't bash expand this variable when I prefix a command with a "one time variable assignment"
– muru
1 min ago
add a comment |
I am trying to set the ENV variable just for the scope of this command
ENV=dev echo terraform plan -state=$ENV.tfstate -var-file=$ENV.tfvars -out=$ENV.plan
the output is for some reason:
terraform plan -state=.tfstate -var-file=.tfvars -out=.plan
Why is it?
I am using bash in osx mojave
bash osx
I am trying to set the ENV variable just for the scope of this command
ENV=dev echo terraform plan -state=$ENV.tfstate -var-file=$ENV.tfvars -out=$ENV.plan
the output is for some reason:
terraform plan -state=.tfstate -var-file=.tfvars -out=.plan
Why is it?
I am using bash in osx mojave
bash osx
bash osx
edited 7 mins ago
Anthony Kong
asked 31 mins ago
Anthony KongAnthony Kong
3512 gold badges7 silver badges18 bronze badges
3512 gold badges7 silver badges18 bronze badges
$ENVis expanded by the shell before callingecho- see the answers at Why is setting a variable before a command legal in bash?
– steeldriver
7 mins ago
Possible duplicate of Why doesn't bash expand this variable when I prefix a command with a "one time variable assignment"
– muru
1 min ago
add a comment |
$ENVis expanded by the shell before callingecho- see the answers at Why is setting a variable before a command legal in bash?
– steeldriver
7 mins ago
Possible duplicate of Why doesn't bash expand this variable when I prefix a command with a "one time variable assignment"
– muru
1 min ago
$ENV is expanded by the shell before calling echo - see the answers at Why is setting a variable before a command legal in bash?– steeldriver
7 mins ago
$ENV is expanded by the shell before calling echo - see the answers at Why is setting a variable before a command legal in bash?– steeldriver
7 mins ago
Possible duplicate of Why doesn't bash expand this variable when I prefix a command with a "one time variable assignment"
– muru
1 min ago
Possible duplicate of Why doesn't bash expand this variable when I prefix a command with a "one time variable assignment"
– muru
1 min ago
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f528859%2fwhy-environment-variable-substitution-does-not-work-in-bash-in-this-case%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f528859%2fwhy-environment-variable-substitution-does-not-work-in-bash-in-this-case%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
$ENVis expanded by the shell before callingecho- see the answers at Why is setting a variable before a command legal in bash?– steeldriver
7 mins ago
Possible duplicate of Why doesn't bash expand this variable when I prefix a command with a "one time variable assignment"
– muru
1 min ago