Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Debugging shell scripts

Status
Not open for further replies.

buxtonicer1

Programmer
Sep 20, 2006
82
GB
Hi guys,
I've recently started to learn unix shell scripting on the ksh. One of the things I'm finding difficult is debugging when the script does not run at I would like. Can you guys provide some types and advice that I can use going forward ?

Thanks in advance :)
 
In the ksh man page have a look at the set builtin (especially -x).

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Are you talking about using set -x to switch on tracing. Is there anything else , that seems sparse or is it that UNIX assumes expert knowledge by the user !
 
set -n Read commands and check them for syntax errors, but does
not execute them. (Ignored for interactive shells).

 
What more are you looking for than set -x provides?

Personally I find the most useful debugging tools are print and/or echo. i.e. put some in the script around the part that isn't working as expected to figure out what's really going on.

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top