Understanding the Shell Prompt


The first thing you see in the Terminal window is the shell prompt (as we saw in Figure 2.1). The shell is a program that sits between you, the user , and the operating system. You type commands to the shell, and the shell reads the input, interprets its meaning, and executes the appropriate commands. This is similar to the way the Finder accepts your mouse clicks, interprets their meaning (single click? double click? drag?), and then performs an appropriate action (select item, open item, move item). The shell prompt is a string of text telling you that your shell is waiting for a command line.

The Shell window (in the Terminal folder under Preferences) allows you to specify which shell the Terminal application will usebut don't change the default until you have mastered the material at least through the end of Chapter 5, "Using Files and Directories." Throughout this book we assume you are using the default shell ( bash ) unless noted otherwise . Now that you know what the shell is, let's start using it.

A Variety of Shells

There are many different shell programs available. The default shell on Mac OS X is called bash . Other shells available on Mac OS X are sh , csh , ksh , tcsh , and zsh . Mac OS X comes with manuals for all of these shells, which you can read at the command line with man shell for example, man bash . See Chapter 3, "Getting Help and Using the Unix Manual."

The sh shell is the oldest commonly used shell sh just means shell . It is also called the Bourne shell after its principal author, Steve Bourne of Bell Labs. Many important system files are actually small programs (scripts) written using sh commands. See Chapter 9, "Creating and Using Scripts."

The default shell for Mac OS X (and for most Linux systems) is bash (for Bourne again shell one of those Unix puns we warned you about). An improved version of the old standby sh , bash adds many useful features to sh while preserving the ability to use all sh commands ( bash is backward compatible with sh ).

The csh shell borrows some of its command syntax from the C programming language (hence the c ) and was designed to be an improvement over the sh shell for interactive use. The tcsh shell is a more advanced form of the csh shell (the t comes from two old DEC operating systems). Many Unix experts consider the csh shell a poor tool for creating scripts. A classic essay making that case is "Csh Programming Considered Harmful" (www.faqs.org/faqs/unix-faq/shell/csh-whynot). In Mac OS X versions prior to 10.3, the tcsh shell was the default shell.

You can learn more about the tcsh shell at www.tcsh.org.

The ksh (the KornShell) was created by David G. Korn at AT&T Bell Laboratories and is backward compatible with the Bourne shell ( sh ), while adding many features from csh and greatly improving performance. The ksh shell is widely used by programmers and system administrators. You can find more information about ksh at www.kornshell.com.

The zsh shell was designed as an improvement on ksh . It has a command syntax very different from that of csh and tcsh . You can learn more about zsh at www.zsh.org. If you find out why it is called zsh , let me know.




Unix for Mac OS X 10. 4 Tiger. Visual QuickPro Guide
Unix for Mac OS X 10.4 Tiger: Visual QuickPro Guide (2nd Edition)
ISBN: 0321246683
EAN: 2147483647
Year: 2004
Pages: 161
Authors: Matisse Enzer

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