Project5.Discover Other Shells


Project 5. Discover Other Shells

This project tells you more about the different Unix shells available and how they compare.

Learn More

Project 46 gives information on the Tcsh shell.


The concept of a shell is hard-wired into Unix, but the actual shell program is not. Consequently, all Unix installations provide a variety of shells and let you choose your favorite. A shell has two primary functions:

  • To provide an interactive experience (the user interface). In this role, we call it an interactive shell. This is where you type a command and the shell executes it. A good interactive experience will make your life at the command line easier.

  • To provide a shell scripting language and execute shell scripts.

Darwin provides all the popular shells:

  • The Bourne shell (command sh) was the first major Unix shell. Several system features depend on this shell and its scripting language. All other shells listed here, except the C and the TENEX C shells, fully support the Bourne shell's scripting language. The Bourne shell provides a primitive interactive experience upon which all the other shells improve.

  • The C shell (command csh) was one of the first shells to improve on the interactive experience of the Bourne shell. Written by Bill Joy at the University of California, Berkeley, it incorporated command history, completion, and job control. Its name comes from similarities between the C programming language and the shell's scripting language. That scripting language, which is widely regarded as flawed, is incompatible with the Bourne shell.

  • The TENEX C shell (command tcsh) is an enhanced but compatible version of the C shell that fixes most of the flaws in that shell's scripting language. It adds a command-line editor, programmable completion, and command/filename spelling correction.

  • The Korn shell (command ksh), written by David Korn, is compatible with the Bourne shell. It includes command-line editing and job control, and is highly customizable. It also enhances the scripting language of the Bourne Shell. Note: The ksh shell was not included in Mac OS X until version 10.4 (Tiger).

  • The Bash shell (command bash) is compatible with the Bourne shell and has a much-improved interactive experience. It incorporates useful features from the Korn and C shells, and enhances the scripting language of the Bourne shell. It's the default shell for Mac OS X and Linux, and the shell assumed throughout this book. Bash stands for Bourne Again Sh!

  • The Z shell (command zsh) is compatible with the Bourne shell. The Zsh shell most closely resembles Ksh but includes many enhancements. It has command-line editing, built-in spelling correction, programmable command completion, shell functions (with autoloading), a history mechanism, and many more features. Paul Falstad originally wrote Zsh.

The default shell in Mac OS X is Bash if your user account was created by Mac OS X 10.3 or later. If your user account was created by an earlier version, you are most likely running Tcsh. To be certain which, or to change your default shell, see "All About Shells" in Project 1. Remember, you can change your current interactive shell temporarily by simply running a new shell.

Learn More

Project 4, and the projects in Chapter 6, teach the Bash shell.


You can run a script written for any of the above shells no matter which shell you are running interactively. The first line of a script should say which shell is to execute it, and your interactive shell will launch the stated shell to do so.




Mac OS X UNIX 101 Byte-Sized Projects
Mac OS X Unix 101 Byte-Sized Projects
ISBN: 0321374118
EAN: 2147483647
Year: 2003
Pages: 153
Authors: Adrian Mayo

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net