6

I need to export a lot of variables like export x1=1 export x2=2

I moved all variables in file .env and tried

source .env

After it I executed

printenv

and all of this variables were absent in the list of env variables. Also I tried export $(xargs <.env) But I have commented lines in .env file and I got following messages

#': not a valid identifier

So how can I export variables from file and skip commented lines?

3
  • 1
    There is already an answer on the Stack Exchange: How to export variables from a file? Commented Jan 11, 2020 at 10:58
  • What exactly does a sample .env file that fails look like? Commented Jan 11, 2020 at 15:36
  • 2
    source ./.env worked for me Commented Nov 3, 2020 at 9:53

1 Answer 1

-3

Try naming a file like variables.env and then try export variables.env echo $somevariable_name

Sign up to request clarification or add additional context in comments.

1 Comment

This does not work at all, this just marks the non-existing variable variables.env to be exported.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.