0

In a bash shell I try to source a file and then have the variables included in the output of printenv/env but they are not. I couldn't find anything about this behavior so far on the web.

MWE:

echo "HALLO=bla" > envfile.env
source envfile.env
echo $HALLO # returns "bla"
printenv | grep HALLO # returns nothing

Is it due to export how do I make sure the variables from a file are included in printenv?

Edit: To clarify the actual problem, I want to set a variable so that it is shown in printenv, (which is used by popper to set the environment in the docker containers).

white_gecko
  • 4,808
  • 4
  • 55
  • 76
  • 1
    Have you tried `echo "export HALLO=BLA"`? – rturrado May 09 '21 at 18:49
  • The [XY](http://meta.stackexchange.com/a/66378) problem is asking about your attempted solution rather than your actual problem. – Cyrus May 09 '21 at 18:55
  • See: [Defining a variable with or without export](https://stackoverflow.com/q/1158091/3776858) – Cyrus May 09 '21 at 19:02
  • 1
    @white_gecko: `printenv` outputs only environment variables, but `HALO` is just a variable, not an environment variable. – user1934428 May 10 '21 at 07:30

0 Answers0