Daniel Schweigh=F6fer wrote:
> I've noticed that shell scripts (like configure scripts) cannot
> access the value of Enviroment Variables which are created after
> initialization of the bash who's calling the scripts.
How are you defining them?
> The only way to get the (non-standard) enviroment variables "into"
> the scripts seems to be putting them down in my profile or directly
> into the scripts themselves. So my questions are:
> - Is this a principal bug from mingw/msys or something that can be
Nope. Assuming that you didn't `export' them, it's completely correct,=
and standard behaviour for *any* Unixy shell.
> - Is there a way to create Enviroment Variables after initialization
> so that my scripts can access to them?
$ export VARNAME=3D"value"
works for bash, (which MSYS sh.exe really is), or ksh; for portability
to less capable shells, you would need
$ export VARNAME ; VARNAME=3D"value"
If you don't `export' variables, they remain private to the process
(shell) in which they are defined, and can't be seen in any child
process, such as a program or script invoked from the shell. FWIW,
neglecting to `export' variables is a common error amongst UNIX
newbies, especially those coming from the MS-DOS/Windows world,
where *all* variables are exported automatically, usually causing
a great deal of environment pollution in child processes.
There is also an automatic `export' capability in Unixy shells,
for *temporary* variables `exported' to a child process:
$ TMPVAR=3D"value" command args
will define `TMPVAR', export it for use by `command', and immediately
`undef' it thereafter, (so it exists only in the environment passed