next up previous contents index
Next: Setting Environment Variables Up: Working Environment Previous: Working Environment

Environment Variables

  

There are many parameters in the shell that define parts of your working environment and which can be set interactively at the command prompt, in shell scripts, or in user-specific profile files (see subsection "The Profile Files" below). Each shell has one or more startup files. Work is currently in progress developing a set of standard startup files (for further information contact Alan Silverman or Tony Cass).

There is one restriction if you define environment variables in a shell script. If the environment variables are to be valid also in the current shell you must invoke the script in a special way without spawning a new process:

 
               		   . myscript 		 for the Bourne Shell

source myscript for the C shell

  Otherwise the environment variables are valid only within the script in which they are declared and all subprocesses invoked from there.

A set of environment variables is already defined by the operating system and can be changed by each user for his personal working environment. In addition, he can of course also define new environment variables. The profile files which serve as an interface for initialisation of these variables at login are described later. By convention, environment variable names are upper case.

A list of the currently-valid environment variables may be obtained with the command

 
               		  env

also printenv in the C shell

In the following examples, for the reasons of simplicity and shortness, the command prompt is assumed to be $.





next up previous contents index
Next: Setting Environment Variables Up: Working Environment Previous: Working Environment



Alan Silverman
Wed Apr 12 16:54:02 METDST 1995