Hello,
I have been using "sh -x script_name" to debug shell script (ksh) on
other machine but it looks like this, sh -x, doesn't work properly on
Sun Solaris 9. Can anyone answer me this? What should I use to debug
ksh script on Sun Solaris 9? set -xv?
Thanks
|
|
0
|
|
|
|
Reply
|
kang_uni (8)
|
4/5/2006 9:35:38 PM |
|
In <1144272938.399255.156650@u72g2000cwu.googlegroups.com> "Herbert" <kang_uni@hotmail.com> writes:
>I have been using "sh -x script_name" to debug shell script (ksh) on
>other machine but it looks like this, sh -x, doesn't work properly on
>Sun Solaris 9. Can anyone answer me this? What should I use to debug
>ksh script on Sun Solaris 9? set -xv?
Have you tried `ksh -x script_name'? Otherwise, `man ksh' should
tell you what you need to know.
--
-Gary Mills- -Unix Support- -U of M Academic Computing and Networking-
|
|
0
|
|
|
|
Reply
|
Gary
|
4/5/2006 10:30:01 PM
|
|
Herbert <kang_uni@hotmail.com> wrote:
> Hello,
>
> I have been using "sh -x script_name" to debug shell script (ksh) on
> other machine but it looks like this, sh -x, doesn't work properly on
> Sun Solaris 9. Can anyone answer me this? What should I use to debug
> ksh script on Sun Solaris 9? set -xv?
If it is a ksh script why don't you call ksh instead of sh:
ksh -x script_name
Remember: The -x flag is reset on function calls, so you will normally only
be able to trace the "main()" part of your shell script if you invoke it
like above.
--
Daniel
|
|
0
|
|
|
|
Reply
|
Daniel
|
4/5/2006 10:52:18 PM
|
|
Gary Mills <mills@cc.umanitoba.ca> writes:
>In <1144272938.399255.156650@u72g2000cwu.googlegroups.com> "Herbert" <kang_uni@hotmail.com> writes:
>>I have been using "sh -x script_name" to debug shell script (ksh) on
>>other machine but it looks like this, sh -x, doesn't work properly on
>>Sun Solaris 9. Can anyone answer me this? What should I use to debug
>>ksh script on Sun Solaris 9? set -xv?
>Have you tried `ksh -x script_name'? Otherwise, `man ksh' should
>tell you what you need to know.
Take a look at the kshdbx package on the blastwave site:
http://www.blastwave.org/packages.php/kshdbx
This is my revision to the kshdb script originally published in the book
"Learning the Korn Shell". It includes a full man page. Below is the
brief description from that site. This is distributed in solaris package
format so it is easy to install and uninstall using the blastwave pkg-get
tool.
Regards,
--
C. Jeffery Small
---------------------------------------------------------------------------
The kshdbx software package provides a debugger for Korn shell (ksh)
scripts. This package offers the following features:
* Step through the code N lines at a time [default: 1]
* List the source code
* Set breakpoints at line numbers
* Set breakpoints at lines containing a specified string
* Set a conditional breakpoint
* Display the value of variables
* Execute arbitrary shell commands at a breakpoint
This tool is based upon the kshdb scripts originally written by Bill
Rosenblatt and published in January 1993 by O'Reilly & Associates in the
book "Learning the Korn Shell" (ISBN: 1-56592-054-6). These scripts were
subsequently republished in the May 1993 issue of UnixWorld Magazine.
---------------------------------------------------------------------------
|
|
0
|
|
|
|
Reply
|
jeff
|
4/5/2006 11:54:18 PM
|
|
On Wed, 5 Apr 2006, Herbert wrote:
> I have been using "sh -x script_name" to debug shell script (ksh) on
Ummm, why are you using sh to test a ksh script?
> other machine but it looks like this, sh -x, doesn't work properly on
> Sun Solaris 9. Can anyone answer me this? What should I use to debug
Ah. You probably use Linux, where "sh" is not sh at all, but bash. THe
latter has facilites that sh does not.
Modulo this, others have posted some good advice on how to debug a ksh
script.
HTH,
--
Rich Teer, SCNA, SCSA, OpenSolaris CAB member
President,
Rite Online Inc.
Voice: +1 (250) 979-1638
URL: http://www.rite-group.com/rich
|
|
0
|
|
|
|
Reply
|
Rich
|
4/6/2006 1:58:35 AM
|
|
"Daniel Rock" <v200614@deadcafe.de> wrote:
> Remember: The -x flag is reset on function calls, so you will
> normally only be able to trace the "main()" part of your shell
> script if you invoke it like above.
....
.... getoptc...
....
-d) DEBUG=true
;;
....
if $DEBUG
then
set -o x
typeset -ft <function_name_1>
...
fi
|
|
0
|
|
|
|
Reply
|
Martin
|
4/12/2006 11:07:37 PM
|
|
|
5 Replies
809 Views
(page loaded in 0.059 seconds)
Similiar Articles: ksh debugging - comp.unix.solarisHello, I have been using "sh -x script_name" to debug shell script (ksh) on other machine but it looks like this, sh -x, doesn't work properly on Sun... I want to run a binary from inside a ksh script - comp.unix ...ksh debugging - comp.unix.solaris I want to run a binary from inside a ksh script - comp.unix ... ksh debugging - comp.unix.solaris I want to run a binary from inside a ... ksh script, exit status and pipe - comp.unix.adminksh or sed search & replace - comp.unix.programmer ksh script, exit status and pipe - comp.unix.admin ksh or sed search & replace - comp.unix.programmer ksh script, exit ... Test regex in KSH - comp.unix.shellperl + regex bug? - comp.lang.perl.misc I removed all unnecessary variable assignments from your regular expressions ... wrote that one in perl ... ksh debugging - comp ... How to launch debugger on remote process,... - comp.os.ms-windows ...ksh debugging - comp.unix.solaris... of open files - comp.sys.hp.hpux pstat_getfile2(2) > if one could remote attach an debugger I'm ... site open ... process to execute ... how to simulate press "spacebar, enter, esc keys" at the unix ...ksh debugging - comp.unix.solaris... to debug shell script (ksh) on other machine but it looks like this, sh -x ... matlab how to simulate press "spacebar, enter, esc ... strace & ptrace under Solaris - comp.unix.solarisksh debugging - comp.unix.solaris strace & ptrace under Solaris - comp.unix.solaris ksh debugging - comp.unix.solaris strace & ptrace under Solaris - comp.unix.solaris ... exit a script, but don't exit matlab - comp.soft-sys.matlab ...ksh debugging - comp.unix.solaris If it is a ksh script why don't you call ksh instead of sh: ksh -x script_name ... comp.unix.solaris How to early exit a script - comp ... Mapping home and end keys - ksh and Putty - comp.unix.shell ...Mapping home and end keys - ksh and Putty - comp.unix.shell ... remote terminal : function keys do not work - comp.unix.solaris ... Mapping home and end keys - ksh and ... Hiding shell script source code??? - comp.unix.programmer ...ksh debugging - comp.unix.solaris Hello, I have been using "sh -x script_name" to debug shell script (ksh) on other machine ... Step through the code N lines at a time ... [Chapter 9] Debugging Shell Programs - MIK telecomWe hope that we have convinced you that the Korn shell can be used as a serious UNIX programming environment. It certainly has enough features, control structures, etc. debugging - Korn Shell - Set "-x" (debug) flag globally? - Stack ...This is ksh88 on an HP-UX machine: me@host ..dev/ $ cat ./test/verbose #!/bin/ksh set -x hello() { print $1 } hello kapow! exit me@host..dev/ $ ./test/verbose ... 7/23/2012 8:36:30 AM
|