next up previous contents index
Next: Microsoft Windows Up: Environment Variables Previous: Environment Variables   Contents   Index


Unix/Linux

Environment variables are maintained by the user's command shell. It is often convenient to set environment variables in a shell startup file such as .cshrc or .login for the C-shell or .profile for the Bourne shell. These files reside in the user's home directory. See the manual page for your shell for more information.

For the C-shell, the command that sets an environment variable is

setenv variable_name [value]
For example,
setenv XT_DUMMY "hello world!"
Note that if the value contains white space, it should be quoted. Note also that it is not necessary to have a value, in which case the variable acts as a boolean (set or not set).

In the C-shell, one can use setenv without arguments, or printenv, to list all of the environment variables currently set.

For a modern Bourne-type shell, such as bash, the corresponding command is

export variable_name[=value]
In this type of shell one can list the variables currently set by giving the shell set command with no arguments.


next up previous contents index
Next: Microsoft Windows Up: Environment Variables Previous: Environment Variables   Contents   Index
Stephen R. Whiteley 2017-10-02