All the code in the scripts so far in this book has been executed from top to bottom. This approach is OK, but you may have noticed that some segments of the code we have covered in our examples has been duplicated further on in the same script.
The shell allows you to group a set of commands or statements into a reusable block. These blocks are called shell functions.
In this chapter we will cover:
using functions from within a script;
using functions from a functions file; and
A function is made up of two parts:
The function label The function body
The label is the function name and the body is the set of commands inside the function. The label name should really be unique; if ...