December 1999
Beginner
528 pages
11h 10m
English
The set command can be used as an aid to debugging. Here are set ’s most useful debugging options.
| set -n | Read commands but do not execute them |
| set -v | Display all lines as they are read |
| set -x | Display all commands and their arguments |
To turn a set option off simply substitute the sign with the +. I always think that it should be the other way round, + to turn it off and to turn it on, but that’s just me.
You can use set at the top of your script to enable it and then disable it when the script finishes, or you can stick set in just a particular block statement that is giving you problems.
Let’s see set in action. Here’s a little script that holds some names in a variable list. The user inputs a name, a for loop then loops ...
Read now
Unlock full access