I know that VARIABLE=value
creates an environment variable, and export VARIABLE=value
makes it available to processes created by the current shell. env
shows the current environment variables, but where do they live? What comprises an environment variable (or an environment, for that matter)?
Bash – What Exactly is an Environment Variable?
bashenvironment-variablesshell
Best Answer
An environment is not as magical as it might seem. The shell stores it in memory and passes to the
execve()
system call. The child process inherits it as an array pointer calledenviron
. From theexecve
manpage:The
environ(7)
manpage also offers some insight:Both of these GNU manpages match the POSIX specification