Debugging Scripts

As you’re developing scripts, you’ll no doubt encounter a few problems in getting them to run properly. As Figure 10.9 shows, you can help debug your scripts by printing the script onscreen as it runs. That way, you can follow the script as it runs and see where the problems might be.

Figure 10.9. Printing the script onscreen as it runs is a great way to debug it.

To Print the Script Onscreen as it Runs:

  • sh -x retentive

    At the shell prompt, type sh -x followed by the script name (and any additional information you need to provide). The -x tells the shell to both execute the script (as usual) and print ...

Get Unix Third Edition: Visual Quickstart Guide 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.