O'Reilly logo

Solaris™ 8 Advanced System Administrator's Guide, Third Edition by Janice Winsor

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required