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

What is delayed write in unix?

0 Answers  


I have one flat file,in this file how many columns are there i don't know,but one ename column is there , just i want to cut the surname, so how to cut the surname, any one know the answer please guide me ? ename ----- tapan kumar nayak bala murugan kutal chkrobarthy biswo My output is like that OUTPUT ------ nayak murugan chakrobarthy biswo

0 Answers   Cap Gemini,


In what way the validity fault handler concludes?

0 Answers  


Why does the server parent need to close the connected socket returns from accept in a concurrent TCP server? What may happen if it does not do so?

1 Answers  


Is unix still around?

0 Answers  






What is path variable in unix?

0 Answers  


What is buffer header unix?

0 Answers  


What are the various ids in unix processes?

0 Answers  


What is unix buffer cache?

0 Answers  


What are states that the page can be in, after causing a page fault?

0 Answers  


How do I grep recursively in unix?

0 Answers  


Is unix written in c?

0 Answers  


Categories