January 2004
Intermediate to advanced
368 pages
7h 25m
English
Although this section does not contain a true script per se, it's a good place to spend a few pages talking about some of the basics of debugging and developing shell scripts, because it's a sure bet that bugs are going to creep in!
The best debugging strategy I have found is to build scripts incrementally. Some script programmers have a high degree of optimism that everything will work right the first time, but I find that starting small, on a modest scale, can really help move things along. Additionally, liberal use of echo statements to track variables, and using the -x flag to the shell for displaying debugging output, are quite useful. To see these in action, let's debug a simple number-guessing game.
Read now
Unlock full access