Customizing Your Computing Environment with Unix Commands
3. Environment Variables
3.2. Modifying Environment Variables
You can customize your environment by adding new environment variables or changing existing ones. However, you may not be able to change some of the variables depending on the permissions set by your system administrator. This is usually the case for
variables such as HOSTNAME, SCRATCHDIR, and so on.
To change or assign a new value to an environment variable, use the Unix setenv command for C-type shells (e.g., tcsh or csh) or the Unix export command for Bourne-type shells (e.g., bash or ksh). The syntax for these commands is as follows:
setenv <variable name> "value"
export <variable name>="value"
To create a new environment variable, you assign a value to a variable name that does not already exist. For example, if you store your project files in a directory named /work/, you could create an environment variable to store the directory name. Below is a sample session using the bash shell that assigns this pathname to an environment variable named MY_WORK.

Figure: Using the setenv command to create an environment variable and set its value.
In the sample session, we confirmed that the variable had been created correctly using the echo command to display its value. If you were using a C-type shell such as tcsh you would have entered the following command:
setenv MY_WORK="/work/"