Chapter 10: Using Loops

In the previous chapter, we started dealing with scripting, and we did a lot of learning about how scripts work and how they are structured. However, we missed a huge topic in scripting – influencing the order in which commands are executed when a script is run. There are a couple of things that we need to cover here, since there are multiple ways we can influence what is going to be the next command executed in a script.

We are going to start with a concept we call iterators or, more commonly, loops. There are a lot of things in everyday tasks that need to be done repeatedly, usually changing just one small thing in every iteration. This is where looping comes in.

We will cover the following recipes in this chapter: ...

Get Linux Command Line and Shell Scripting Techniques 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.