Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • 1
    You should clarify that the contents of $env_args have no effect in variable expansion in the command string itself: env A=B echo "$A" echos nothing (or echos what $A already contained). Commented Dec 22, 2015 at 22:30
  • @alexis - does A=B echo "$A" behave any differently for you? Commented Dec 23, 2015 at 8:05
  • It's the same (except that the env command allows pre-expansion of the variable definition string, which was what the OP needs). I should have included the env, but my point applies equally to both versions: any variables in the command itself will be expanded before the custom definitions take effect. The adjusted environment is only useful inside the program. On the other hand, A=B; echo "$A" (as two commands) will of course echo B. Commented Dec 23, 2015 at 8:28