Introduction
rom 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.
-
ksh - Korn shell
- sh
- Bourne shell
- csh
- C shell
- tcsh- A better C shell
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".
#!/bin/ksh
for f in *.foo; do
mv $f ${f%foo}bar
done
#end
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:
- PATH - a list of directories that shell scans when it looks for a program
file to execute. The shell always scans that list from the
beginning to end so the order is important.
- DISPLAY - this variable is used by X-Window applications to determine what
X server should they connect to. This variable is set for
you automatically in the system startup script. It usually
contain the name of your machine followed by something like :0.0
If this variable is set incorrectly, then you may be unable to
run your X applications.
- TERM - editors and other programs check this variable to determine what
kind of terminal you have. This variable may contain something
like "VT100" if you are working from an alphanumeric terminal or
using telnet. It usually contains "xterm" if you are using X Windows.
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.