home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  

Book HomeBook TitleSearch this book

3.3. Shell Flavors

Many different Unix shells are available. This quick reference describes the three most popular shells:

Most systems have more than one shell, and people will often use the Bourne shell for writing shell scripts and another shell for interactive use.

The /etc/passwd file determines which shell takes effect during your interactive Unix session. When you log in, the system checks your entry in /etc/passwd. The last field of each entry names a program to run as the default shell.[4] For example:

[4]On Solaris or other networked Unix systems, this information may come from NIS or NIS+. Usually, your system administrator will handle this for you; just don't be surprised if your login name doesn't appear in /etc/passwd.

If the program name is:Your shell is the:
/bin/shBourne shell
/bin/rshRestricted Bourne shell
/bin/jshBourne shell, including job control
/bin/kshKorn shell

The Desktop Korn shell, a version of ksh93 (Solaris only)

/bin/rkshRestricted Korn shell
/bin/cshC shell

You can change to another shell by typing the program name at the command line. For example, to change from the Bourne shell to the Korn shell, type:

$ exec ksh

Note that on most systems, rsh is the “remote shell” for executing commands on a remote system across a network. On some systems, though, rsh is indeed the restricted shell, and remsh is the remote shell. Check your local documentation.

3.3.1. Which Shell Do I Want?

If you are new to Unix, picking a shell may be a bewildering question. Before ksh was commonly available, the general advice was to use csh for interactive use (because it supported job control and had other features that made it a better interactive shell than the Bourne shell), but to use the Bourne shell for scripting (because it is a more powerful programming language, and more universally available).

Today, ksh is widely available; it is upwardly compatible with the Bourne shell as a programming language, and it has all the interactive capabilities of csh, and more. If it is available, it is probably your best choice.

Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.