CHAPTER 3Basic Shell Scripting

This chapter introduces the basics of control flow in the shell. The shell's functionality is moderately baroque, and many shell features have elaborate interactions. This chapter glosses over the full (and rather gory) details of the shell's quoting and variable expansion features, leaving them for Chapter 4. Instead, this chapter introduces the basic programming features of the shell, showing how to control the execution of shell scripts, join programs together, and interact with files. This framework makes it much easier to provide meaningful examples while exploring the rather more complicated territory of the shell's expansion and quoting mechanisms.

Scripts presented without command prompts may be run directly ...

Get Beginning Portable Shell Scripting: From Novice to Professional 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.