A very basic way to think of Environment Variables is like so... Think of the shell as any other program that you were capable of writing, compiling and running. Your program maintains information about it's current state, and well a shell is no different. Since the shell's main job is to act as a liaison between the kernel and the user, it maintains information about the computing environment.
Certain applications and commands may communicate with the shell and reference the environment variables that it maintains. For example it seems that "frm" and "nfrm" seem not to work it $MAIL is not defined.
Most all UNIX systems provide a command that will allow you to see all of these variables that the shell is maintaining. On must systems this is accomplished by using the "env" command.
Here is an example of the "env" command issued on one of the linix.gl servers using the tcsh shell...
HOME=/afs/umbc.edu/users/d/h/dhood2/home USER=dhood2 LOGNAME=dhood2 PATH=.:/afs/umbc.edu/users/d/h/dhood2/home/bin:/afs/umbc.edu/users/d/h/dhood2/home/bin/sgi:/usr/local/bin:/usr/bsd:/bin:/usr/bin:/usr/sbin:/usr/bin/X11:/usr/local/X11:/etc:/usr/etc:/usr/k5/bin:/usr/afsws/bin:/bin:/usr/java/bin:/usr/afsws/bin:/usr/X11R6/bin MAIL=/afs/umbc.edu/users/d/h/dhood2/Mail/inbox SHELL=/bin/tcsh SSH_CLIENT=XX.XX.XX.XX 33887 22 (sorry - I'm hiding my IP address) SSH_TTY=/dev/pts/0 TERM=xterm DISPLAY=linux2.gl.umbc.edu:10.0 KRB5CCNAME=FILE:/tmp/krb5cc_l29893 HOSTTYPE=i386-linux VENDOR=intel OSTYPE=linux MACHTYPE=i386 SHLVL=1 PWD=/afs/umbc.edu/users/d/h/dhood2/home GROUP=general HOST=linux2.gl.umbc.edu REMOTEHOST=XX.md.comcast.net (sorry - I'm hiding my hostname) HOSTNAME=linux2.gl.umbc.edu LS_COLORS=no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;32:*.bat=01;32:*.sh=01;32:*.csh=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;35:*.xbm=01;35:*.xpm=01;35:*.png=01;35:*.tif=01;35: LESSOPEN=|/usr/bin/lesspipe.sh %s TZ=EST5EDT MANPATH=/usr/X11R6/man:/usr/k5/man:/usr/local/man:/usr/man:/usr/share/man EDITOR=/usr/local/bin/pico |
Some things to note...
The PATH is nothing more than a list of directories in which to look for executable commands. Note that if the same command lives in more than one of these places the first one in the path listing is the one that is used. To complicate this matter even more, the versions that are in these different directories may be different, as it the case with gcc (the C compiler) at the time of this writing.