Chapter 9. Debugging Scripts
This chapter shows how to debug Bash shell scripts.
Programming in any language, be it C, Java, FORTRAN, COBOL*, or Bash can be a lot of fun. However, what is often not fun is when something goes wrong, and when it takes an inordinate amount of time to find the problem and then solve it. This chapter will attempt to show the reader how to avoid some of the more common syntax and logic errors, and also how to find them when they occur.
*COBOL: Okay, I have to say that programming in COBOL was never fun!
The topics covered are in the chapter are:
How to prevent some common syntax and logic errors.
The shell debugging commands such as
set -x
andset -v
.The other ways to set up debugging.
How redirection can be used to debug in real time.