Chapter 3. Effective Script Writing

To write an effective script in shell, it is very important to know about the different utilities that shell provides. Similar to other programming languages, shell programming also requires a way to specify skipping or running certain commands under certain conditions. To perform a certain task on the list of elements, looping constructs are needed in shell as well.

In this chapter, we will cover topics such as if, else, case, and select that can be used to run a certain block of commands according to the condition. We will see the for, while, and until constructs, which are used to loop over a certain block of commands in a script. We will see how the exit code, after the execution of a command or script, plays ...

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