The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to debug the awk script chella Shell Programming and Scripting 2 11-08-2007 07:51 PM
Debug an Awk Script mboro Shell Programming and Scripting 1 10-01-2007 06:05 AM
Difference between writing Unix Shell script and AIX Shell Scripts haroonec AIX 0 04-12-2006 02:27 AM
disk space script debug - posted before bryan Shell Programming and Scripting 3 04-28-2005 07:50 PM
“Ostream” object is not printing message on HP-UNIX for debug mode heena UNIX for Advanced & Expert Users 0 09-13-2004 05:08 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-20-2008
psiva_arul's Avatar
psiva_arul psiva_arul is offline
Registered User
  
 

Join Date: Jul 2007
Location: Bangalore, India
Posts: 95
How can debug our UNIX shell script?

Hi all,

i have two simple questions here...

1. i want to know that how to debug the UNIX shell script?
2. is there any way to handling the exception in UNIX shell script like oracle exception handling?

Please provide me those details it would be great help/

Thanks and Regards,
MPS
Bangalore
  #2 (permalink)  
Old 05-20-2008
andryk's Avatar
andryk andryk is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2003
Posts: 448
Hi,
Just a quick reply/hint as im not a shell expert , add "set -x" in the begining of the script, this will display all commands that are about to be executed, hopefully helping you to know where your shell might bug ...
For 'handling exceptions' you can only catch signal like segfault, sigint (user hitting break key, etc ...) with the "trap" keyword ...

Good luck hunting bugs
  #3 (permalink)  
Old 05-20-2008
wrapster wrapster is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 193
Hi,
on the overview,if your a naive user ,then the easiest way is to use

bash -xv <your script>

Assuming your using bash as your shell....
This will print the output line by line and will also include every statement with the corresponding actions,attributes and parameters you've passed!!!
It will list out each arg as and when they are called in the script ,so that it will be easier to debug...

Regards

PS:if your script is lengthy,be ready to scroll pages at a time, helpful nevertheless
  #4 (permalink)  
Old 09-07-2008
ksailesh ksailesh is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 7
u can debug unix scripts using ksh -vx <filename> , using echo statements and creating log files
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 12:40 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0