Chapter 27. Shell Interpretation
What the Shell Does
As we’ve said, the shell is just another program. It’s responsible for interpreting the commands you type. There are several commonly used shells, primarily based on two or three major families and a wide variety of other projects:
The Bourne shell (sh) and its derivatives and progeny (including bash, ash, and even the Korn shell ksh)
The C shell (csh) and its progeny (including tcsh)
The Korn shell (ksh) and variants (including pdksh and zsh [1])
Specialized shells based on languages such as Python, TCL, perl, and so on.
Shells invented to meet specific needs such as restricted command access (rsh), recovery after a system failure (sash), and downloading, installing, and configuring software libraries.
If you can think of a reason to have a specialized shell, someone probably has already written one to meet that need.
Interpreting your commands might seem simple enough, but a lot of things happen between the time you press RETURN and the time the computer actually does what you want. The process of interpretation is very complex: the shell has to break the command into words and expand aliases (Section 29.2), history operators (Section 30.8), and shell and environment variables (Section 35.3, Section 35.9). It also sets up standard input and output streams (Section 43.1) and performs a lot of other tasks. Indeed, if a command looks right but doesn’t work right, the cause is probably either one of the following:
File permissions ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access