What is the difference between a shell variable that is
exported and the one that is not exported?

Answers were Sorted based on User's Feedback



What is the difference between a shell variable that is exported and the one that is not exported? ..

Answer / mahendra swain

When we export the variable that will available in subshell
If simply define variable that is only available in current shell.
Example: #var=20
#echo $var
20
If you invoke #sh i.e subshell of bash and try to print that unexported variable valu you will not get that.
sh-2.05b# echo $var-----it does not print the valu of var b'caz still it is in bash shell memory.
Just see the exported variable in shell
[root@dhcppc0 root]# export var1=30
[root@dhcppc0 root]# sh
sh-2.05b# echo $var1
30
I hope you will be enjoy it.

Is This Answer Correct ?    8 Yes 0 No

What is the difference between a shell variable that is exported and the one that is not exported? ..

Answer / mrinmoy

Only exported variables can be inherited by another program
while other variables can not be used.

Is This Answer Correct ?    3 Yes 0 No

Post New Answer

More Unix General Interview Questions

How unix is different from other operating systems?

0 Answers  


Explain about the directory representation in UNIX?

0 Answers  


Where is unix used today?

0 Answers  


If we are terminated at the middle of the program execution in UNIX,what will happen to the program, it will continue running r terminate r the o/p will be send to your mail?

0 Answers   Apps Associates,


Is unix free?

0 Answers  


What are the features of unix?

0 Answers  


Is mac built on unix?

0 Answers  


Is unix the first operating system?

0 Answers  


How to change the password in unix operating system?

0 Answers  


Explain kernal and shell?

0 Answers  


What is the procedure to configure MC/SG Cluster services in HP-UX 11i v3 OS Environment?

0 Answers   IBM,


Define the term directory?

0 Answers  


Categories