The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM
Home Forums Register Rules & FAQ Members List Arcade Search Today's Posts Mark Forums Read


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.


Other UNIX.COM Threads 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 03:51 PM
Debug an Awk Script mboro Shell Programming and Scripting 1 10-01-2007 03:05 AM
Difference between writing Unix Shell script and AIX Shell Scripts haroonec AIX 0 04-11-2006 11:27 PM
disk space script debug - posted before bryan Shell Programming and Scripting 3 04-28-2005 04:50 PM
“Ostream” object is not printing message on HP-UNIX for debug mode heena UNIX for Advanced & Expert Users 0 09-13-2004 02:08 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-20-2008
psiva_arul's Avatar
Registered User
 

Join Date: Jul 2007
Location: Bangalore, India
Posts: 71
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
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
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 05-20-2008
andryk's Avatar
Registered User
 

Join Date: Sep 2003
Posts: 448
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
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
Reply With Quote
  #3 (permalink)  
Old 05-20-2008
Registered User
 

Join Date: Jan 2008
Posts: 171
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
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
Reply With Quote
Google UNIX.COM
Reply



Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB 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 -7. The time now is 03:33 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger

Search Engine Optimization by vBSEO 3.1.0

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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102