This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Source a .bat file from bash


Hi Saurabh,

On Fri, Aug 9, 2013 at 10:42 PM, Saurabh T wrote:
> Is there a way to source a .bat file from bash and have the paths and other environment variables set in it apply in cygwin?
>

Note that "to source" in UNIX shell parlance means "read the file and
interpret it". Bash can't do that with a .bat file (it's in a
different language).

You could run cmd.exe to interpret the .bat file, but changes to th
environment get lost when cmd.exe exits. One possibility is to run
bash from the cmd.exe window after the batch has finished.

some_command could be:

cp $1 /tmp/bat-to-bash-$1
echo 'c:\cygwin\bin\bash.exe --login' >> /tmp/bat-to-bash-$1
cmd.exe /tmp/bat-to-bash-$1

(this might work, but I haven't tested it)

Csaba
-- 
GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++
The Tao of math: The numbers you can count are not the real numbers.
Life is complex, with real and imaginary parts.
"Ok, it boots. Which means it must be bug-free and perfect. " -- Linus Torvalds
"People disagree with me. I just ignore them." -- Linus Torvalds

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]