LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Shell Script Exporting Issue (https://www.linuxquestions.org/questions/linux-software-2/shell-script-exporting-issue-497639/)

trek413 11-01-2006 03:15 PM

Shell Script Exporting Issue
 
I'm writing a script in shell and, in the script, I use
the export command multiple times to set some environment
variables. Though, when I run the script the values are
never set.

Pertinent information:

Script interpreter = #!/bin/sh

user shell = bash

example of export command:

Code:

export TEST2=15


Any ideas? thanks.

gilead 11-01-2006 04:18 PM

It sound like you're running the script in its own sub-shell. For example:
Code:

/path/to/script/script.sh
If you source the script from the current shell, the exported variables should be available:
Code:

source /path/to/script/script.sh
or
. /path/to/script/script.sh



All times are GMT -5. The time now is 03:32 AM.