Debugging Shell Scripts
The following sections provide some suggestions for debugging shell scripts.
Using Debugging Flags
A common problem when writing shell scripts is that the shell does not interpret the command in exactly the way that you expect. When the shell interprets a command line, it substitutes variables with values, replaces file-name wildcards with the appropriate file names, and performs command substitution. If the interpretation transforms a command line into something unexpected, the command most likely will not execute the way you intend it to.
All three shells provide -x (echo) and -v (verbose) options that you can use to help pinpoint where problems are occurring in a script. The -v option displays each line of the script ...
Get Solaris™ 8 Advanced System Administrator's Guide, Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.