Setting Environment Variables
Environment variables are used to configure the $G development environment. They contain user specific settings that can be read by programs and tools to access files and directories.
- Linux Environment Variables
Users can set environment variables in their login script or from the command line. On Linux users can use one of several shells and the procedure will vary depending on which shell you use. The two most common shells are tcsh and bash. You can see what shell you are using with:
> finger $USER
Amongst other things this will display either Shell: /bin/tcsh or Shell: /bin/bash.
- Setting up /bin/tcsh and /bin/csh
When you login the script named .cshrc in your home directory is run to setup your user environment. A generic copy is provided in student accounts. Note that files that begin with a dot are hidden when you browse the directory. By convention they are used to initialize programs.
You can add your own settings to personalize the script. A good way to do this is to keep your personal settings in a separate script file you create. First edit the .cshrc file to invoke your personal script. If you use the vi editor you would type:
> vi $HOME/.cshrc #Edit the login script.
Make up a name for you personal settings file and add a line at the bottom to invoke it. In this example the file name is .my_settings, but you should probably use a more specific name like your name.
source ${HOME}/.my_settings
Next create the new file and edit it to add commands to set your environment variables. Over time you'll collect other settings. To set the environment variable CVSROOT to the directory /map/gfx0/cvsroot you would add:
setenv CVSROOT /map/gfx0/cvsroot
- Setting up /bin/bash
When you login the script named .bashrc in your home directory is run to setup your user environment. A generic copy is provided in student accounts. Note that files that begin with a dot are hidden when you browse the directory. By convention they are used to initialize programs.
You can add your own settings to personalize the script. A good way to do this is to keep your personal settings in a separate script file you create. First edit the .bashrc file to invoke your personal script. If you use the vi editor you would type:
> vi $HOME/.bashrc #Edit the login script.
Make up a name for you personal settings file and add a line at the bottom to invoke it. In this example the file name is .my_settings, but you should probably use a more specific name like your name.
source ${HOME}/.my_settings
Next create the new file and edit it to add commands to set your environment variables. Over time you'll collect other settings. To set the environment variable CVSROOT to the directory /map/gfx0/cvsroot you would add:
export CVSROOT=/map/gfx0/cvsroot
- Windows Environment Variables
There are several ways to set up environment variables in Windows. Windows provides a way to setup environment variables in the registry. If you have a preferred command shell program you'd like to use then it will probably have a setup mechanism for environment variables. The procedure varies for each command line program so you'll need to consult the reference manual for instructions. Visit this site for instructions on setting up environment variables in the Windows registry:
http://support.microsoft.com/kb/310519