This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Source a .bat file from bash
- From: Csaba Raduly <rcsaba at gmail dot com>
- To: cygwin at cygwin dot com
- Date: Mon, 12 Aug 2013 10:18:10 +0200
- Subject: Re: Source a .bat file from bash
- References: <DUB123-W29CB87179CAE6145C437BBB1580 at phx dot gbl>
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