Is there a way to create an .env file that defines a variable with the value of another variable?

I have tried using: var1=$var2

And it obviously doesn't work.

Any takes?

closed as unclear what you're asking by Gilles, jordanm, cuonglm, Anthon, G-Man Sep 25 '15 at 6:08

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    What software uses this .env file? – thrig Sep 24 '15 at 17:55
  • You can source them from the bash using source .env and all the variables defined there will be available as environment variables. – René Olivo Sep 24 '15 at 18:07

What does "doesn't work" mean?

$ echo -n $var1
$ echo 'var1=$PATH' > whatever
$ cat whatever
$ source whatever
$ echo $var1

Not the answer you're looking for? Browse other questions tagged or ask your own question.