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 and shell scripting languages 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 07:44 AM
Capture Oracle return code in shell script Vikas Sood Shell Programming and Scripting 1 05-22-2006 06:32 PM
Store return code of shell script in oracle table sveera Shell Programming and Scripting 3 05-04-2005 02:25 PM
Return Code of tar in AIX dupeng AIX 3 02-23-2004 12:05 AM
mailx in kornshell script passing return code to CA-Unicenter Connie UNIX for Advanced & Expert Users 1 04-23-2002 09:45 AM

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 03-28-2006
mpang_ mpang_ is offline
Registered User
  
 

Join Date: Mar 2006
Posts: 89
return code from script

hey all,

I have a simple script

#!/bin/bash

./cron.sh test_a.txt &
./cron.sh test_b.txt &

wait


I want to invoke another program based on the return status of the above calls. How am I were to get that? Thanks!
  #2 (permalink)  
Old 10-23-2007
krk_555 krk_555 is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 14
Hi,
I am also facing the same iissue if any one can reply it would be very helpful for me.
  #3 (permalink)  
Old 10-23-2007
gus2000 gus2000 is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 157
Well...the short answer is "you can't do that". In the above example, the return code is lost.

One answer is to write the return code to a file:
(myscript.sh; echo $? > /tmp/rc1) &
wait
RC1=$(cat /tmp/rc1)
You would need to make sure the temporary file is unique, but this should work. There aren't any elegant solutions, really.
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 01:22 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