The UNIX Forums
"Join the Network of UNIX System Users"


 
Subject: tracing a ksh script within a ksh script
hoster007
Newbie
Rank: 1



UID 177
Digest Posts 0
Credits 0
Posts 20
Reading Access 10
Registered Apr 25, 2007
Status Offline
Post at Jun 20, 2007 10:40 AM  Profile | P.M. 
tracing a ksh script within a ksh script



tracing a ksh script within a ksh script



i normally trace a script with the ksh -x <script name> and redirect strderr to file. but if you have a script like the examble below......

vi hairy

bear=`grep bear animals`
if [ -n $bear ]
then
ksh more_animals
fi


if i ksh -x hairy it won't trace "more_animals" unless i put a -x in it. is there a way to trace the original script and it will trace all other scripts within without actually have to add the -x? i have scripts invoking scripts that is invoking other scripts and it would be a pain to trace them all down to just add the -x.


Top
alarik
Newbie
Rank: 1



UID 46
Digest Posts 0
Credits 0
Posts 48
Reading Access 10
Registered Apr 25, 2007
Status Offline
Post at Jun 20, 2007 10:40 AM  Profile | P.M. 
you can set the env variable to a file that has "set -x" in it. like this:
code:
$ cat one
#! /usr/bin/ksh

./two
./three
exit 0
$ cat two
#! /usr/bin/ksh
echo in two
exit 0
$ cat three
#! /usr/bin/ksh
echo in three
./four
exit 0
$ cat four
#! /usr/bin/ksh
echo i am number 4
exit 0
$
$
$
$
$ ./one
in two
in three
i am number 4
$
$
$
$ cat debug
set -x
$ export env=debug
$
$ ./one
+ ./two
+ echo in two
in two
+ exit 0
+ ./three
+ echo in three
in three
+ ./four
+ echo i am number 4
i am number 4
+ exit 0
+ exit 0
Top
 

 

All times are GMT, the time now is Mar 22, 2010 08:44 PM

Powered by Discuz! 5.0.0  © 2001-2006 UNIX Forums
Processed in 0.005448 second(s), 8 queries

Clear Cookies - Contact Us - UNIX Help - Archiver - WAP