Now that our scripts become more complex, it’s time to look at what happens when things go wrong. In this chapter, we’ll look at some of the common kinds of errors that occur in scripts and examine a few useful techniques that can be used to track down and eradicate problems.
One general class of errors is syntactic. Syntactic errors involve mistyping some element of shell syntax. The shell will stop executing a script when it encounters this type of error.
In the following discussions, we will use this script to demonstrate common types of errors.
#!/bin/bash# trouble: script to demonstrate common errorsnumber=1 ...