confusion with export


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting confusion with export
# 1  
Old 05-11-2006
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.
# 2  
Old 05-11-2006
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.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Confusion with the concept of wc -c and wc -m

Is wc -c and wc -m same ? Shellscript::cat file1 hello Shellscript::cat file1 | wc -c 6 Shellscript::cat file1 | wc -m 6 Shellscript::file file1 file1: ASCII text Shellscript::uname -a Linux was85host 2.6.27.45-0.1-vmi #1 SMP 2010-02-22 16:49:47 +0100 i686 i686 i386 GNU/LinuxAtleast... (5 Replies)
Discussion started by: shellscripting
5 Replies

2. UNIX for Dummies Questions & Answers

Confusion with ++ operator

Can anyone guide me whats happening in this program given below. I got the Output 7 7 12 49... i was expecting 5 16 9 25. First is simple (3+1)*(3+1) Second is again 3*3; i =4 now Third i =5 then 5*5; i don't know where i am going wrong! #include<stdio.h> #define PRODUCT(x) (x*x) int... (5 Replies)
Discussion started by: Abhishek_kumar
5 Replies

3. IP Networking

iptables Confusion

Hi all, I am looking to get a few questions answered but I am having trouble finding an answer to these specific questions online. 1. Order of operations: THere are plenty of fancy diagrams online that illustrate the order of operations for IPTables (Raw before Mangle for example) but what I... (1 Reply)
Discussion started by: knightfirefx
1 Replies

4. Shell Programming and Scripting

Confusion with PS

Hello All, I have a problem in counting number of process getting run with my current script name.. Here it is ps -ef | grep $0 | grep -v grep This display just one line with the PID, PPID and other details when i print it in the script. But when I want to count the numbers in my... (11 Replies)
Discussion started by: sathyaonnuix
11 Replies

5. Homework & Coursework Questions

Server Confusion

I don't even know where to start with this one. There is so much out there about different aspects of this. I am starting with a basic Ubuntu 11.04 install. Do I need to configure a DNS? I am a little confused about that. What do I need to do for a domain name? I have followed various tutorials,... (1 Reply)
Discussion started by: polyglot0727
1 Replies

6. UNIX for Dummies Questions & Answers

crontab confusion

I come across an entry in cron which is in such: 0 * * * * What is the first 0 indicating? 0 minute? meaning a script cron as such will run every minute? :confused: (2 Replies)
Discussion started by: user50210
2 Replies

7. UNIX for Dummies Questions & Answers

'tr' confusion

Good day, everyone! Could anybody explain me the following situation. If I'm running similar script: Var="anna.kurnikova" Var2="Anna Kurn" echo $Var | tr -t "$Var" "$Var2" Why the output is : anna KurniKova instead of Anna Kurnikova? :confused: Thank you in advance for any... (2 Replies)
Discussion started by: Nafanja
2 Replies

8. UNIX for Dummies Questions & Answers

wc command confusion

Can somebody explain it to me that why wc gives more chars suppose Ab.txt have two lines qwer qasd then wc -c ab.txt will give 10.why not 8.okay may be it is taking count one for each line just in case but why echo "qwer"|wc -C gives 5. Ok with \c it is returning 4. :) (6 Replies)
Discussion started by: Dhruva
6 Replies

9. UNIX for Dummies Questions & Answers

ISO Confusion?

Hiya folks, Just a quick question. When I am ready to download Fedora core 4, do I need to download all 4 ISO files? Or just one, I think myself it would be all 4 but dont want to sit and wait around if I only need to download one. Also after downloading the Iso files, do I burn one file to one... (6 Replies)
Discussion started by: Mr_Pinky
6 Replies

10. UNIX for Dummies Questions & Answers

Clear confusion

Hi, In some machines when i type "clear" it completely clears all the contents on that window but on some it simply scrolls up all the content. How can i change this? (4 Replies)
Discussion started by: vibhor_agarwali
4 Replies
Login or Register to Ask a Question