Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Global variable
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Environment variables== [[Environment variables]] are a facility provided by some [[operating systems]]. Within the OS's [[shell (computing)|shell]] ([[KornShell|ksh]] in [[Unix]], [[Bash (Unix shell)|bash]] in [[Linux]], [[COMMAND.COM]] in [[DOS]] and [[CMD.EXE]] in [[Windows]]) they are a kind of variable: for instance, in unix and related systems an ordinary variable becomes an environment variable when the <code>export</code> keyword is used. Program code other than shells has to access them by [[API]] calls, such as <code>getenv()</code> and <code>setenv()</code>. They are local to the process in which they were set. That means if we open two terminal windows (Two different processes running shell) and change value of environment variable in one window, that change will not be seen by other window. When a child process is created, it inherits all the environment variables and their values from the parent process. Usually, when a program calls another program, it first creates a child process by [[fork (Unix)|fork]]ing, then the child adjusts the environment as needed and lastly the child [[exec (Unix)|replaces]] itself with the program to be called. Child processes therefore cannot use environment variables to communicate with their peers, avoiding the action at a distance problem.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)