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
Korn Shell Script to find out error in logfile jithu Shell Programming and Scripting 2 04-24-2008 03:12 PM
Handling Errors in Shell Scripts sarsani UNIX for Dummies Questions & Answers 2 12-24-2006 10:16 AM
how to convert from korn shell to normal shell with this code? forevercalz Shell Programming and Scripting 21 11-23-2005 02:18 AM
KORN Shell - Spawn new shell with commands frustrated1 Shell Programming and Scripting 2 04-20-2005 03:23 PM
Null handling in scripts mohanprabu Shell Programming and Scripting 3 01-20-2005 04:50 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-29-2005
bhgopi bhgopi is offline
Registered User
  
 

Join Date: Aug 2005
Posts: 6
Smile Error Handling in Korn Shell scripts

Hi,

I am using few ISQL statements to update and delete from a few tables in sybase, now i want to roll back the transaction when any of the statements fail.How i can i capture these errors in the shell scripts.Please advise.

Thanks,
Gopi
  #2 (permalink)  
Old 09-02-2005
bakunin bakunin is offline Forum Staff  
Bughunter Extraordinaire
  
 

Join Date: May 2005
Location: In the leftmost byte of /dev/kmem
Posts: 1,628
catch the errorlevel of the command:

[code]
...
/path/to/somecommand ; RC=$?
if [ $RC -eq 0 ] ; then
print - "everything worked out fine"
else
print - "something screwed up"
fi
[code]

The errorlevel is set anew for every command issued, so be sure to get it as soon as the program in question is finished.

bakunin

Last edited by RTM; 09-02-2005 at 09:50 AM..
  #3 (permalink)  
Old 09-02-2005
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,798
Quote:
Originally Posted by bakunin
[code]
...
/path/to/somecommand ; RC=$?
if [ $RC -eq 0 ] ; then
print - "everything worked out fine"
else
print - "something screwed up"
fi
[code]

bakunin
I agree its only a print.. but it is against point 1 of this post ?

Last edited by RTM; 09-02-2005 at 09:50 AM..
  #4 (permalink)  
Old 09-02-2005
RTM's Avatar
RTM RTM is offline Forum Advisor  
Hog Hunter
  
 

Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
Bakunin - please refrain from profanity. Thanks. (Edited both post and changed the offending word)
  #5 (permalink)  
Old 09-06-2005
denverd0n denverd0n is offline
Registered User
  
 

Join Date: Sep 2005
Location: Colorado
Posts: 9
Checking the return code won't help. What bhgopi wants to do is rollback the transaction within Sybase. By the time you get the Unix return code the transaction is already committed.

Bottom line: You have to check the results and do the rollback or commit entirely from within isql. You probably should be asking this question on a Sybase forum, rather than Unix.
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:50 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
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