What is the difference between a shell variable that is
exported and the one that is not exported?
Answer Posted / 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 |
Post New Answer View All Answers
What is unix and its features?
What is the role of the kernel in unix?
Explain the method of changing file access permission?
What are the types of unix operating system?
What is unix mtime?
Differentiate multiuser from multitask.
Which is a form of interprocess communication in unix?
What are shell variables?
What is tilde unix?
List some of the frequent shells used in unix along with their indicators?
What is the property of unix?
What are the bits that support the demand paging?
What are unix options?
What is a regular file in unix?
How would you explain a kernel to a non-technical person?