
how do I export a shell variable
Gregory J. Sandell (sand...@sparky.parmly.luc.edu) wrote:
: I am using csh. Suppose I have a script that sets a variable, then
: finishes, for example in foo.mac below:
: cat > foo.mac <<!
: #! /bin/csh
: set myvar=1 # or, setenv myvar 1
: !
: Now I have another script that calls foo.mac and want to know the value
: of $myvar:
: cat > bar.mac <<!
: #! /bin/csh
: foo.mac
: echo $myvar
: !
: How do I get $myvar known to bar.mac? I don't care if I need to use set
: or setenv.
Uh, first of all, don't use csh for scripting. Just take my word for
it. There is still time for you not to end up as me.
# in the "top-level" script:
source foo.mac
source bar.mac
# script bar.mac knows myvar=1
--
-Brian
,---. ,---. ,---. ,---. ,---. ,---. ,---.
/ _ \ / _ \ / _ \ / _ \ / _ \ / _ \ / _ \
.' / \ `.' / bsh20...@challenger.atc.fhda.edu `.' / \ `.' / \ `.
__,' `.___,' `.___,' `.___,' `.___,' `.___,' `.___,' `.__