University of Virginia Department of
    Computer Science


From the FAQ maintained by the ITC helpdesk:
The shell is a command line interpreter between you and the Unix operating system. The shell accepts your commands and then executes them. The shell has a large number of built in commands as well as the capability of being a programming language

Changing your shell

Fortunately there are many different shells around. If you don't like your current login shell (i.e., the one you get when you log in) you can always replace it with a better one. More information on shell differences and how to change your shell.

Shells available in the department

These are some of the department-supported shells. They reside in /bin. Some popular shells are user-contributed and live in /usr/cs/contrib/bin:

Shell scripts

Any UNIX shell is capable of interpreting programs written in the language of that shell. Such programs are called shell scripts.

Here is an example of a Korn shell script taken from part two of comp.os.unix FAQ. It renames all files "*.foo" to "*.bar".

        for f in *.foo; do
            mv $f ${f%foo}bar
The first line of this example tells your current shell that the Korn shell must be invoked to execute the script. For more examples and information on writing scripts see UNIX scripts FAQ maintained by ITC helpdesk.

Any shell is a command language interpreter. Though some of the shells are considered more suitable for script programming than others. For example, you should be aware that csh programming might be a dangerous thing.

.login, .profile and other "dot" files

When a UNIX shell starts or terminates it automatically executes certain scripts. Names of the script files always begin with a dot. A list of "dot" files that various shells use. You can put in these files whatever commands you want to execute at start-up and/or termination of every UNIX session.

Environment Variables

Any shell maintains a set of string variables called environment variables. Those variables are available to any program started from that shell. Some of them are used by the shell itself. Here are some important variables: There are many other environment variables. Every shell has its set of commands to view and set them. For example, in Korn shell setenv prints a list of environment variables, <name>=<value> assigns string <value> to the variable <name>, export makes a name visible for the programs started from the shell. For more information follow the specific shell links provided above.

See also

HelpNet was created by the 1997 incoming graduate class. It is only occasionally updated.