CHAPTER 13Scripting and Functions

A shell script may contain no more than a few commands, although the shell offers a complete programming language. Using features like loops and condition tests can allow you to do very powerful things just from the command line. Often, however, it can be useful to save a set of commands in a file for later reuse. This aspect of scripting was largely covered in Chapter 2. In this chapter we focus on more advanced uses of scripting where the script needs to make decisions based on its inputs or to the result of previous operations. A particular aim of this chapter is to introduce ways in which shell programming can be used to extend the base functionality of the shell. That theme continues into the following ...

Get From Bash to Z Shell: Conquering the Command Line 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.