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.
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 out the individual command lines, as shown in Figure 10.9.
✓ Tip
Use the name of any shell, followed by -x, followed by the script name for this kind of debugging output. For example, try bash -x retentive.
3.129.211.87