Chapter 5. And Away We Go

Based on the discussions in Chapter 3, “What Is the Shell?,” you should realize that whenever you type something like

who | wc -l

that you are actually programming in the shell! That's because the shell is interpreting the command line, recognizing the pipe symbol, connecting the output of the first command to the input of the second, and initiating execution of both commands.

In this chapter, you'll learn how to write your own commands and how to use shell variables.

Command Files

A shell program can be typed directly at the terminal, as in

$ who | wc -l

or it can be first typed into a file and then the file can be executed by the shell. For example, ...

Get Unix Shell Programming, Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.