Environment Variables

Environment variables are often used to define initialization options such as the default login shell, user login name, search path, and terminal settings. Some environment variables are set for you each time you log in. You can also create your own variables and assign values to them. By convention, environment variable names are in capital letters.

Environment variables are passed on from parent to child processes. For example, an environment variable set in a shell is available to any program started in that shell, to any additional program started by the initial program, and so on. In other words, environment variables are inherited from parent to child, from child to grandchild, and so on. They are not inherited backward from parent to grandparent or child to parent.

Use the env command to display a list of current environment variables. Consult the Solaris System Administrator's Guide, Third Edition, for more information about environment variables.

Bourne and Korn Shell Environment Variables

For the Bourne and Korn shells, use the following syntax to assign environment variables and export them. You must export the variable before it can be put into the environment of child processes.

							VARIABLE=value;export VARIABLE
						

For the Korn shell, you can also use the following syntax.

export VARIABLE=value
						

For the Bourne and Korn shells, use the unset command with the following syntax to remove an environment variable.

unset VARIABLE
						

C Shell Environment Variables

For the C shell, use the setenv command with the following syntax to assign environment variables.

setenv VARIABLE value
						

Use the unsetenv command with the following syntax to remove the environment variable.

							unsetenv VARIABLE
						

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.58.39.129