The C-shell Environment

When a user opens a terminal window in an IRIX session (called a winterm) or logs in to the system from a remote location they open a new environment called a shell. In this document we will consider only the c-shell since this is the most commonly used shell. The shell defines an environment for command line interaction with the underlying operating system, UNIX. The c-shell defines the command line syntax as well as other features such as maintaining a history of commands for that session, management of running processes (called jobs), as well as other features. The c-shell can be accessed directly from the command line by the user or by use of command scripts which define a list of shell operations in a file that can be executed like a program.

When a new c-shell is started several files are accessed to set up the environment. First a global command script for all c-shell users is read. This file, called cshrc (C-Shell ResourCe), resides in the /etc/ directory and is write-protected from users. Next two files in each user’s home directory are read, .login and .cshrc. These can be modified by individual users in various ways to personalize the user’s environment and increase the power of the shell. See the section, Modifying the .cshrc File, below, for more details.

The c-shell also maintains a list of variables that define essential information or set variables relating to the environment, called environmental variables. Since new variables can be easily defined from within the shell, environmental variables are often used to set information and options about the operation of programs. For instance, to use a theoretical program convert_all, which converts all kinds of image formats, it may be necessary to set an environmental variable named CONVERT_FORMATS to a directory containing format definitions for the program. Setting and examining the environmental variables can be accomplished using the commands described below.

setenv [variable] [value]

setenv CONVERT_FORMATS /usr/people/mcdermoj/formats

Sets the specified environmental variable to the value given.

env

Lists all currently defined environmental variables with their values.