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

Why is a script important?

795


What is inside a seashell?

895


Where are cowrie shells found?

805


Explain about login shell?

847


Why is it called a shell?

737


How will you pass and access arguments to a script in linux?

847


What is shell scripting used for?

793


Calculate a real number calculation directly from the terminal and not any shell script.

959


What are the four fundamental components of every file system on linux?

1435


Print a given number, in reverse order using a shell script such that the input is provided using command line argument only.

969


What is shell variable?

735


What is the meaning of $1 in shell script?

869


What is a batch file used for?

819


What is the use of echo in shell script?

816


Rewrite the command to print the sentence and convert the variable to plural: echo “i like $variable”.

856