You can inherit the environment variables from PID 1 by iterating over the list of null-terminated strings
/proc/1/environ, parsing the first characters up to the first
= as the variable name, setting the
remaining value as that variable, and exporting it.
The Code Snippet
This works with multiline environment variables, and environment variables with arbitrary values, like
= or JSON blobs.
Paste this in your current terminal session to inherit the environment variables from PID 1:
while read -r -d $'