Environment Variables

Each shell provides variables that are accessible by all programs.

When command executed, it need to know some environment information called environment variables.

For example, when command is executed, shell searches the executable file,

first it looks up the PATH environment variable, searches the file in all the path set in the PATH.

When you log in, your shell executes each command in your startup file ( .tcshrc or .cshrc or .bashrc ) which is

a script file to set your working environment.( See Below for the sample startup files )

How to see the current values of environment variables:

:>printenv
or
:>env

How to see the current setting for particular variable:
For example, PATH :

:>echo $PATH

How to change your environment variables :

For example,
When your current $PATH is PATH=usr/ucb:/bin:/usr/bin:/usr/local/bin:/usr/bin/X11:/usr/openwin/bin:.
And you want to add another path( /usr/ccs/bin /p/gcc-2.8.1 /p/gnu /p/perl /p/gdb-4.17/bin $HOME/bin ) into the current one :

:>setenv PATH "$PATH:/usr/ccs/bin:/p/gcc-2.8.1:/p/gnu /p/perl:\
/p/gdb-4.17/bin:$HOME/bin"
or
:>set path = ( $path /usr/ccs/bin /p/gcc-2.8.1 /p/gnu /p/perl \
/p/gdb-4.17/bin $HOME/bin )

Check the sample .tcshrc file , .cshrc file , or .bashrc file to see how environment variables are set.

See the more information about setting your environment variables.