UNIX for OpenVMS Users, Third Edition

10.10: Debugging Shell Scripts

10.10 Debugging Shell Scripts

You can explicitly invoke the C, bash, or Korn shell programs using the commands csh, bash, 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:

$ SET VERIFY$ @<i class="emphasis">command_procedure</i>

% csh [<i class="emphasis">option(s)</i>] <i class="emphasis">script_file</i>

Example:

% cat test_script

$ TYPE TEST.COM$ DIR /FULL 'P1'$ EXIT$ SET VERIFY$ @TEST_SCRIPT A$ DIR /FULL A[directory listing here]$ EXIT

'P1' ls -l $1exit% csh -x test_script als -l aA -rwxr-xr-x 1 fred 32 Aug 8 19:19 aexit<a name="636"></a><a name="IDX-359"></a>

Example:

% csh -v test_script als -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. And of course, -xv can be used to turn both options on at the same time. The -X and -V options (not shown) extend the features of...

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.