Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Each and every shell has its own environment. There's no <em>Universal</em> environment that will magically appear in all console windows. An environment variable created in one shell cannot be accessed in another shell.</p> <p>It's even more restrictive. If one shell spawns a subshell, that subshell has access to the parent's environment variables, but if that subshell creates an environment variable, it's not accessible in the parent shell.</p> <p>If all of your shells need access to the same set of variables, you can create a <em>startup</em> file that will set them for you. This is done in BASH via the <code>$HOME/.bash_profile</code> and <code>$HOME/.bashrc</code> files and through <code>$HOME/.profile</code> if <code>$HOME/.bash_profile</code> doesn't exist). Other shells have their own set of startup files. One is used for logins, and one is used for shells spawned without logins. See the manpage to learn exactly what startup scripts are used and what order they're executed).</p> <p>You can try using shared memory, but I believe that only works while processes are running, so even if you figured out a way to set a piece of shared memory, it would go away as soon as that command is finished. (I've rarely used shared memory except for named pipes). Otherwise, there's really no way to set an environment variable in one shell and have another shell automatically pick it up. You can try using <a href="http://www.linuxjournal.com/article/2156">named pipes</a> or writing that environment variable to a file for other shells to pick it up.</p> <p>Imagine the problems that could happen if someone could change the environment of one shell without my knowledge.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload