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
Passing a variable from a child script back to the parent Andy82 Shell Programming and Scripting 3 05-26-2008 10:52 PM
Parent/child Korn shell script help sasaliasim Shell Programming and Scripting 1 05-06-2008 06:09 PM
Can a child process return a specific value to a parent process ? Ametis1970 High Level Programming 8 04-10-2008 12:22 AM
How to know parent script name from child script raki Shell Programming and Scripting 2 06-05-2006 09:01 AM
return valuse from child script to parent script borncrazy Shell Programming and Scripting 1 08-20-2004 04:39 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 06-16-2008
suchismitasuchi suchismitasuchi is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 3
How to return control from the child script to the parent one?

I have two shell scripts : A.sh and B.sh

A.sh
echo "In A"
exec B.sh
echo "After B"

B.sh
echo "In B"

The output is : In A
In B

I want the output : In A
In B
After B
  #2 (permalink)  
Old 06-16-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
Then don't use exec -- it's not doing what you think it does.

Code:
echo "In A"
B.sh
echo "After B"
If B.sh is not in your path, you need to specify an explicit path (perhaps just ./B.sh)
  #3 (permalink)  
Old 06-16-2008
danmero danmero is offline Forum Advisor  
  
 

Join Date: Nov 2007
Location: 45.48-73.63
Posts: 1,431
Code:
$ cat A.sh
echo "In A"
./B.sh
echo "After B"

$ cat B.sh
echo "In B"
  #4 (permalink)  
Old 06-16-2008
manas_ranjan's Avatar
manas_ranjan manas_ranjan is offline
Registered User
  
 

Join Date: Jul 2007
Location: Amsterdam
Posts: 177
with above option, please check whether your b.sh has any exit code or not ????
if so, then most probably , after sucessfully executing b.sh , it's exitng out from your script because of this exit.

This one is my assumption .
  #5 (permalink)  
Old 06-16-2008
danmero danmero is offline Forum Advisor  
  
 

Join Date: Nov 2007
Location: 45.48-73.63
Posts: 1,431
Quote:
Originally Posted by manas_ranjan View Post
This one is my assumption .
Bad assumption, please try before you buy
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 07:41 AM.


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