This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Source a .bat file from bash
- From: Earnie Boyd <earnie at users dot sourceforge dot net>
- To: cygwin at cygwin dot com
- Date: Mon, 12 Aug 2013 10:33:00 -0400
- Subject: Re: Source a .bat file from bash
- References: <DUB123-W29CB87179CAE6145C437BBB1580 at phx dot gbl> <CAEhDDbBvppt2o5g1rpyCpxva7sga-bhkEPctoa8nau=pX0Btqw at mail dot gmail dot com>
On Mon, Aug 12, 2013 at 4:18 AM, Csaba Raduly <rcsaba@gmail.com> wrote:
> 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).
>
That is only half true. I have and a little success with bash reading
a .bat file but you must obey the rules of bash syntax or overcome it
and vice versa. Tedious at best.
> 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.
>
Or just start a Cygwin shell from the .bat file. That child of the
.bat file would contain the environment from the parent but the parent
cannot receive the environment of the child.
--
Earnie
-- https://sites.google.com/site/earnieboyd
--
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