Previous Section  < Day Day Up >  Next Section

15.1. Introduction

Programmers often spend more time debugging programs than writing them. Because many shell programs perform tasks that can affect the entire operating system, making sure those scripts perform properly is imperative. Whether you are a user or a system administrator writing scripts to automate simple or complex tasks, you want your script to do what you want it to do, and not cause weird and unexpected surprises even after all the syntax errors have been weeded out. The expression "If it ain't broke, don't fix it" is often ignored when you are thinking of ways to "improve" a script that is already working. Perhaps you think your script should be a little more user-friendly, might need some cosmetic surgery, or a little more error checking. Or you might even be cleaning up some other programmer's code. So, you put the script back in the editor, type, type, type, exit the editor, and run the program. Whoops! It's broken! @<!@%5#!>!! This chapter aims to provide an invaluable tool for finding, fixing, and understanding many types of errors that cause shell scripts to misbehave and leave you frustrated, wasting a lot of time that you probably don't have.

    Previous Section  < Day Day Up >  Next Section