The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
to pick up the Return Code ( RC) from the mailx command and return it to SAS uisng 's manas6 UNIX for Dummies Questions & Answers 0 06-05-2008 03:44 AM
how to get return code in one line bluemoon1 Shell Programming and Scripting 6 09-13-2007 07:09 PM
asking about return code naamas03 Shell Programming and Scripting 3 08-28-2007 01:53 AM
Informix function return value needs to be captured in shell script jeniferz UNIX for Dummies Questions & Answers 3 04-15-2005 02:33 PM
Return Code of tar in AIX dupeng AIX 3 02-22-2004 09:05 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 09-05-2006
Playing with Ubuntu Now!
 

Join Date: Oct 2005
Location: Chennai
Posts: 364
return code not captured

Hi all,
We have a script in our Unix box(HP-UX 11.11) which is invoked as
Code:
script1.sh param1 param2 >>${logfile}               script2.sh "param"
Actually the script2 is also called from the same line. There is no semicolon between the 2 calls. I also checked the octal dump. What happens here is that the return code of the script1 is checked in script2. 2-3 days back, script1 failed but script2 didnt catch the error.

What I would like to know is whether this is a valid syntax? And why the script2 doesnt catch the error? Any suggestions would be very helpful.

Regards,
Ranj

Last edited by ranj@chn; 09-05-2006 at 03:38 AM. Reason: typo
Reply With Quote
Forum Sponsor
  #2  
Old 09-05-2006
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,297
Code:
possibilities:
script1.sh param1 param2 >>${logfile}  ||             script2.sh $? "param"
script1.sh param1 param2 >>${logfile}     &&          script2.sh "param"
Normally, if you want script2 to "see" previous error status you have to pass status to it or have the shell intervene. The only other possibility is to have script1 write status to a file. Then script2 reads the file.
Reply With Quote
  #3  
Old 09-06-2006
Playing with Ubuntu Now!
 

Join Date: Oct 2005
Location: Chennai
Posts: 364
thanks Jim

Thanks Jim. So, the above syntax is wrong then. I will work the suggestions and come back later.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 11:39 PM.


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

Content Relevant URLs by vBSEO 3.2.0