Chapter 7. Compound Commands

Except for the simplest scripts, you seldom want to execute every command. It's helpful to execute one set of commands instead of another, or repeat a set of commands several times. Compound commands are commands that enclose a group of other commands.

For readability, the enclosed commands are indented to make it clear that their execution depends on the compound command. I once had a supervisor complain that I occasionally indented my lines one space less than the standard he insisted on. (I had to put a ruler up to the screen to see whether it was true.) I figured this was a minor problem because he went to another programmer and pointed out that his program crashed when a zero was typed.

Compound commands always ...

Get Linux Shell Scripting with Bash 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.