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

Answer Posted / tony

By default, Shells will only keep all variables to the Shell in which they run. This is good, since it assumes variables are not needed outside of a given script. In most cases, that is correct. But, if you have a script that you want to use to set Shell variables, it must be exported in some way. Alternative ways to export variables, is to call a script with "source" or just with a dot and a whitespace.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to find duplicate record in file using shell script?

944


I want to create a directory such that anyone in the group can create a file and access any person's file in it but none should be able to delete a file other than the one created by himself.

672


Why are shell scripts used?

695


Explain about non-login shell files?

798


How to use arguments in a script?

659






How does ls command work?

678


Is shell scripting useful?

660


What are the different commands available to check the disk usage?

566


What is a boot block?

668


How do I stop script errors?

650


What is the significance of $#?

676


What is shell and shell script?

647


I have 2 files and I want to print the records which are common to both.

799


What is a batch file used for?

649


What are scripts in psychology?

675