two little things.

I use this line in my .kshrc to debug ksh scripts

export PS4="ksh debug \\$LINENO | "

once you run a script with ksh -x or put set -x in it you see output like..
enoexec ksh:  ksh -x utds
ksh debug 33 | ksh debug 33 | uname -s
OS=SunOS
ksh debug 34 | [ SunOS = SunOS ]
ksh debug 36 | PSOPTS=-o ppid,pid,comm
ksh debug 49 | trap echo "$0: Interrupted "; exit 1 INT QUIT
ksh debug 51 | ksh debug 51 | basename utds
USAGE=Usage: utds { start | stop | restart }
ksh debug 54 | UTPRODINFO=/etc/opt/SUNWut/basedir/lib/utprodinfo
ksh debug 55 | [ -x /etc/opt/SUNWut/basedir/lib/utprodinfo ]
ksh debug 57 | ksh debug 57 | /etc/opt/SUNWut/basedir/lib/utprodinfo -p SUNWutdso BASEDIR
ksh debug 57 | 2> /dev/null
BASEDIR=/opt
ksh debug 60 | [ -z /opt ]
ksh debug 64 | PATH=/sbin:/bin:/usr/sbin:/usr/bin:/opt/SUNWut/srds/lib:/opt/SUNWut/srds/sbin
ksh debug 65 | LD_LIBRARY_PATH=/opt/SUNWut/srds/lib:/home/timu/src/malloclib/sparc/libs
ksh debug 66 | export PATH LD_LIBRARY_PATH
ksh debug 67 | UTPUSHD=/opt/SUNWut/srds/lib/utpushd
ksh debug 68 | UTDSD=/opt/SUNWut/srds/lib/utdsd
ksh debug 77 | ExitCode=0
ksh debug 82 | [ ! -f /etc/opt/SUNWut/srds/current/utdsd.run ]
ksh debug 90 | [ -f /etc/opt/SUNWut/srds/current/utdsd.ini ]
ksh debug 92 | . /etc/opt/SUNWut/srds/current/utdsd.ini
utds[92]: /etc/opt/SUNWut/srds/current/utdsd.ini:  not found

with the number after the debug being the line in the script that was being executed..

Comments:

works great for Bash, too, in ~/.bashrc. thanks Tim.

Posted by Calum Mackay on August 04, 2005 at 07:09 AM GMT+00:00 #

Does this work with ksh93, too ?

Posted by guest on August 31, 2006 at 07:58 AM GMT+00:00 #

seems to work in /usr/dt/bin/dtksh which is ksh93 according to emacs mode \^V Version M-12/28/93d tim

Posted by tim on August 31, 2006 at 08:13 AM GMT+00:00 #

Post a Comment:
  • HTML Syntax: NOT allowed
About

timatworkhomeandinbetween

Search

Archives
« April 2014
MonTueWedThuFriSatSun
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Today
News

No bookmarks in folder

Blogroll

No bookmarks in folder