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

Is cmd a shell?

598


What is the meaning of $1 in shell script?

594


How to check if the previous command was run successfully?

597


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

698


What are the disadvantages of shell scripting?

638






How do I edit a .sh file?

624


What is a file basename?

594


What happens on a system call?

562


What is an sh file?

559


What does $@ mean bash?

668


is this growing field and what is average package in this?

1872


How can I set the default rwx permission to all users on every file which is created in the current shell?

906


How do you create a shortcut in linux?

595


Is shell a scripting language?

572


What are the different types of variables used in shell script?

554