Jump to content

Environment variable

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 63.226.55.198 (talk) at 16:22, 25 October 2003 (Environment variables). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

Environment variables are a set of dynamic values that can affect the way the running process will behave.

In most Unix shells, each process has its own private set of environment variables that most likely were copies of the environment variables of the parent process.

Examples of environment variables include the PATH, which tells the shell where to search for commands the user may type.

DISPLAY - For x-windows to know which server to use PS1, PS2, PS3 - Define what the shell should use for a prompt HOME - Users home directory SHELL - Current shell

All Unix operating system flavors and DOS have environment variables, however they do not all use the same variable names.

Shell scripts and batch files use environment variables to store temporary values for reference later in the script.

Compiled programs can also access the environment variables, for instance in a C program you can check the value of an environment variable using the getenv() function.

Usually an environment variable that is changed in a script or compiled program will only affect that process and possibly child processes. The parent process and any unrelated processes will not be affected.