< Day Day Up > |
Many different Unix shells are available. This quick reference describes the three most popular shells:
The original Bourne shell is available as /bin/sh on commercial Unix systems, and if invoked as sh, Bash will do its best to emulate the original Bourne shell's behavior. However, it is rare today to find the original Bourne shell being used interactively as a login shell; other shells that provide better interactive features and the Bourne shell's programming language, such as Bash and ksh, are more popular. However, when writing shell scripts, most people are careful to restrict themselves to just those features of the Bourne shell. 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.[*] For example:
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 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, a wide variety of Bourne-compatible shells are available that all support job control and some sort of command history and command-line editing. Of these, Bash is arguably the most popular, and it is a good choice. If Bash is not available but the Korn shell is, you should use the Korn shell. In any case, source code for both shells (as well as others) are easily available from the Internet. |
< Day Day Up > |