One of the most annoying tasks of shell scripting is debugging problems. There are aids to help you but, to prevent most errors before they happen, follow this rule:
Break your proposed script down into tasks or procedures, then code and test each procedure before continuing with the next step.
In this chapter we will cover:
common errors; and
introducing the set command.
There really is nothing more irritating than trying to discover an elusive error in your script. However, as you get more experienced in scripting you’ll know what to look for.
The most common problems are missing quotes or not having an fi on the end of an if statement.
One important thing to remember is that when the shell reports an error from ...