Export command in shell script?


Suppose in a program a line is there:


and then
what will happen if i write a command:
export XYZ 


The issue is that scripts run in a private subshell, and therefore don't affect the shell that called them.

If we pretend that we have a script like this:

# Name: test_script 

export OOGA=echo 'ooga' 
export BOOGA=echo 'booga' 

Then we can add it to the current shell by using the source command:

source test_script


Thanks to kupendra for this tip on the forum.
Published by aakai1056. Latest update on January 9, 2010 at 07:43 AM by aakai1056.
This document, titled "Export command in shell script?," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (https://ccm.net/).
Launch and run commands from shell script
Network management with the Linux Shell