[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

exported shell variables and scope

I've had a problem with this issue for a long time now, and have never
been able to properly resolve the issue. I am not able to get a broad
enough scope to shell defined variables.

Simple process: one shell script defines a bunch of variables and the next
shell script uses them to perform the work.

Here is the first script:

pwd >/tmp/pwd
export DBXDEV=`pwd`
export TPGM=`cat /tmp/pwd`
export PATH="$PATH:$TPGM:$TPGM/bin"
echo "PATH:$PATH"
echo "TPGM:$TPGM"

and its output:


but when I do an 'env' or test for the variables in another shell, none of
these variables exist! (Well, PATH exists, but is the old path)

I've seen this sort of design before in other people's scripts, and they
work fine. What am I missing, and how do I distribute these values to
other scripts?


_-_-_-_-_-   Author of "Dwarf's Guide to Debian GNU/Linux"  _-_-_-_-_-_-
_-                                                                    _-
_- aka   Dale Scheetz                   Phone:   1 (850) 656-9769     _-
_-       Flexible Software              11000 McCrackin Road          _-
_-       e-mail:  dwarf@polaris.net     Tallahassee, FL  32308        _-
_-                                                                    _-
_-_-_-_-_-  Released under the GNU Free Documentation License   _-_-_-_-
              available at: http://www.polaris.net/~dwarf/

Reply to: