UNIX for OpenVMS Users, Second Edition

Section 10.10: Debugging Shell Scripts

10.10 Debugging Shell Scripts

You can explicitly invoke the C or Korn shell programs using the commands csh or ksh, respectively, supplying one or more options and the name of a script at that time. Two of those options, x and v, provide debugging aid during execution of the script. The result is similar to using the OpenVMS command SET VERIFY, either prior to or as part of a command procedure.

OpenVMS

UNIX (C shell)

Form:

$ <b class="bold">SET VERIFY</b>$ <b class="bold">@<span class="emphasis"><icommand_procedure</i></span></b>
% <b class="bold">csh [<span class="emphasis"><ioption(s)</i></span>] <span class="emphasis"><iscript_file</i></span></b>

Example:

$ <b class="bold">TYPE TEST.COM</b>
% <b class="bold">csh -v test_script a</b>
$ DIR /FULL 'P1'$ EXIT$ <b class="bold">SET VERIFY</b>$ <b class="bold">@TEST_SCRIPT A</b>$ DIR /FULL A<span class="emphasis"><i[directory listing here]</i></span>$ EXIT
ls -l $1exit% <b class="bold">csh -x test_script a</b>ls -l a-rwxr-xr-x l fred 32 Aug 8 19:19 aexit

Example:

% <b class="bold">csh -v test_script a</b>ls -l $1-rwxr-xr-x 1 fred 32 Aug 8 19:19: aexit

The construct csh -x test_script a echoes the command lines after variable substitution ( x option), and csh -v test_script a echoes the command lines prior to variable substitution ( v option). Hence, the x option is useful for locating problems in variable substitution, and the v option is useful for locating the line on which a script file is failing. The X and V options (not shown) extend the features of x and v to include the .cshrc file...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: DC-DC Converter Chips
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.