CHAPTER 2Input, Output, and Throughput

Two of the commands we used in Chapter 1 are workhorses of the shell scripter's stable: echo and printf. Both are bash builtin commands. Both print information to the standard output stream, but printf is much more powerful, and echo has its problems.

In this chapter, I'll cover echo and its problems, the capabilities of printf, the read command, and the standard input and output streams. I'll start, however, with an overview of parameters and variables.

Parameter and Variables

To quote the bash manual (type man bash at the command prompt to read it), "A parameter is an entity that stores values." There are three types of parameters: positional parameters, special parameters, and variables. Positional ...

Get Pro Bash Programming: Scripting the GNU/Linux Shell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.