Operating System - HP-UX
1830898 Members
2938 Online
110017 Solutions
New Discussion

Re: debug mode during script execution

 
SOLVED
Go to solution
James Barry Donovan
Occasional Contributor

debug mode during script execution

I have knowledge on how to turn on debug mode within C++ and VMS, how to you do the same running a script in HP-Ux

e.g. in C++
define debug 1
e.g. in OpenVMS
$ set verify
7 REPLIES 7
harry d brown jr
Honored Contributor
Solution

Re: debug mode during script execution


to turn on verbose mode

set -x

to turn off

set +x

You can't DEBUG, but you can see verbosely what is going on!

With perl you can DEBUG, that's why I prefer to script in perl!


live free or die
harry
Live Free or Die
S.K. Chan
Honored Contributor

Re: debug mode during script execution

Use "set -x" (set -o xtrace can also be used to enable shell tracing). To disable shell tracing use "set +x" (or set +o xtrace).
Mark Greene_1
Honored Contributor

Re: debug mode during script execution

ksh -x [script]

you will also want to add these lines to the top of the script to make it easier to follow:

PS4='${0##*/}:$LINENO: '
typeset -ft $(typeset +f)


HTH
mark
the future will be a lot like now, only later
MANOJ SRIVASTAVA
Honored Contributor

Re: debug mode during script execution

Hi James


Even in the shell scripting you can use #!/usr/bin/ksh -x

to enable the debug option , at teh start of the script .


Manoj Srivastava
Sachin Patel
Honored Contributor

Re: debug mode during script execution

Hi James,

Here it is if you have csh (c-shell) script.

#csh -x script_name

Sachin
Is photography a hobby or another way to spend $
John Carr_2
Honored Contributor

Re: debug mode during script execution

Hi

and the posix

sh -x script_name

john.
hpuxrox
Respected Contributor

Re: debug mode during script execution

In the first line of your script put an -x after the ksh. example,

#! /usr/bin/ksh -x