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
Confusion about 1>&2 and 2>&1 navi Shell Programming and Scripting 1 06-03-2008 07:26 AM
'tr' confusion Nafanja UNIX for Dummies Questions & Answers 2 12-05-2007 07:47 PM
Sed confusion alfredo123 Shell Programming and Scripting 3 11-17-2006 08:16 AM
ftp confusion intern UNIX for Dummies Questions & Answers 1 06-08-2006 03:20 PM
ISO Confusion? Mr_Pinky UNIX for Dummies Questions & Answers 6 09-19-2005 03:14 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-11-2006
Registered User
 

Join Date: May 2006
Posts: 3
Stumble this Post!
confusion with export

Hi,
I have written the following two scripts.

a.ksh --->

FPATH=/users/kushard
autoload b
b
echo "From a.ksh::" $aa

b --->

function b
{
typeset aa
aa="TRUE."
echo "From b::" $aa
export aa
}

But I cannot see the value of aa being populated in a.ksh.
Please let me know where I am wrong.


regards,
Dipankar.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 05-11-2006
Playing with Ubuntu Now!
 

Join Date: Oct 2005
Location: Chennai
Posts: 364
Stumble this Post!
o/p is correct

The o/p is correct. export means - let the variable value be known to its subshells. 'b' is called from a.ksh(parent). So, what the child exports is not visible to parent.

I tried writing a function 'c' -
function c
{
echo "Called form c::$aa"
}


Called it from 'b' and it worked --
function b
{
typeset aa
aa="TRUE."
echo "From b::" $aa
export aa
autoload c
c
}

Now when I run the a.ksh - I get
From b:: TRUE.
Called form c::TRUE.
From a.ksh::

I hope I am clear.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 11:42 AM.


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 Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0