The reason for the environment variable not being defined after the shell
script has finished is the same reason why the variable is no longer defined
after you exit and restart the MSYS shell. The shell script runs as a child
process, so any changes in its environment are not reflected in the parent
process, and this is the same as the "call" command in Windows command
prompt. To run a shell script without a separate subprocess, use the "."
Note the space after the ".".
----- Original Message -----
From: "Paul G." <pgarceau@...>
Sent: Monday, June 10, 2002 9:40 AM
Subject: [Mingw-msys] "export"?
> Here's what I have observed in the last half hour or so (it was only
5:30pm local time ;-) ), even though it took me
> over an hour to actually get it typed up in some sort of cohesive fashion
for this particular m/l.
> (forgive the attachments and blow-by-blow account, but couldn't think of
another way to show this to everyone. Also,
> everyone should note, before looking at the attachments that I am using
Unix line endings, not MS line endings.)
> First (case), I opened MSYS, and entered, "export >> virgin_exp.txt".
This is the first attachment, to give
> everyone a baseline to work from and to be sure we are all on the same
> Second (case), I closed and re-opened Msys, then assigned a variable I
wanted to be exported
> (environment) with the following command at the bash prompt:
> export CRYSTAL="/usr/local/crystal"
> and then typed: "export >> expvar_bp.txt"
> (see attachment expvar_bp.txt)
> If you take a look, you will see that CRYSTAL is defined as follows:
> export CRYSTAL="/usr/local/include"
> Finally, I closed Msys, and reopened it once again.
> This time, however, I used a .sh script (see msys_prep.sh -- remember, I
am using Unix line endings) to
> invoke the "export" command. Here are the actual steps:
> (At bash prompt) "msys_prep.sh"
> (At bash prompt) "export >> expvars_sh.txt"
> The attached file, expvars_sh.txt, shows the results of that. If you take
a look, you will see that CRYSTAL is
> not defined as an export.
> (At bash prompt) "set >> set.txt"
> If you want to take a look at the "set.txt" file, you will note that
CRYSTAL is not defined.
> In the first and second cases, noted above, CRYSTAL was always listed when
the command "set" was
> So there you have it. A blow-by-blow of what occurred.
> My question:
> Is this the way things are supposed to be with "export"?
> Doesn't seem like it, nor does it feel like it should be this way with
"export" command. Just my take on it.
> Paul G.