Implementing commonly used procedures via functions
By this point, we have created a lot of different and very simple scripts that more or less used echo
and a few commands just to show how a particular thing in bash
works. In this recipe, we are going to give you a couple of ideas on how to use what we have learned so far.
Getting ready
We are going to create a small script that is going to show you how to easily automate the most mundane tasks on any system. The idea here is not to show you every task possible, but instead to show you how to tackle the most common problems.
How to do it…
Before we even start with the script, we need to go back to the recipes where we were explaining how to start writing scripts. What we are talking about are the prerequisites and presumptions we are going to make when we create and run this script.
Every script will have its own prerequisites. These are usually a list of things that your script needs to run—either...