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
  • AFAIU, that only gives you the stuff that was in the environment when the shell process was executed, not anything it read later from whatever startup files it reads Commented Oct 26, 2023 at 19:06
  • 1
    That's what OP wants, I think. My understanding: they set some environment variables in their shell and then run the script shown in the question, which also modifies the environment using the .env file, but they want the values they manually set to take precedence. This way, when they run the script, /proc/self/environ will have those values. Commented Oct 27, 2023 at 1:33
  • 2
    Beware environment variable names are not necessarily mappable to shell variable names. The environment could contain things like -a=b or a[$(reboot)]=c, or even entries without =s such as -p. Commented Oct 27, 2023 at 13:20