Timeline for Safely save and restore environment variables
Current License: CC BY-SA 4.0
4 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 27, 2023 at 13:20 | comment | added | Stéphane Chazelas |
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.
|
|
| Oct 27, 2023 at 1:33 | comment | added | muru |
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.
|
|
| Oct 26, 2023 at 19:06 | comment | added | ilkkachu | 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 | |
| Oct 26, 2023 at 16:24 | history | answered | muru | CC BY-SA 4.0 |