Suppose I have a bat (or cmd) script that sets an environment variable:
rem set_foo.bat
SET foo=XXX
I want to call that script from a Cygwin bash script, in such a way that the variable set by set_foo.bat is visible by the Cygwin bash script. That is, this Cygwin bash script:
#!/bin/sh
<call set_foo.bat in such a way that FOO becomes visible to this Cygwin script>
echo FOO is ${FOO}
should print:
FOO is XXX
Is this possible, and how?
PS 1: I am aware of the solutions proposed here: cygwin environment variables set in bat file, and they are NOT what I want.
PS 2: The bat script is not under my control (the Cygwin bash script is), so any solution that involves tweaking the bat script is not acceptable.
PS 3: If I just call set_foo.bat from the Cygwin bash script like this:
#!/bin/sh
set_foo.bat
echo FOO is ${FOO}
then the value of FOO is not visible. That is, the Cygwin bash script prints:
FOO is 
 
     
    