Does anyone know how to invoke a bash process via a dos batch program so commands after bash execute?

Lipin, Adam Adam.Lipin@morganstanley.com
Tue Apr 13 18:02:00 GMT 2004


That works. Thanks a lot.

-----Original Message-----
From: cygwin-owner@cygwin.com [mailto:cygwin-owner@cygwin.com] On Behalf
Of Dave Korn
Sent: Tuesday, April 13, 2004 11:03 AM
To: cygwin@cygwin.com
Subject: RE: Does anyone know how to invoke a bash process via a dos
batch program so commands after bash execute?


> -----Original Message-----
> From: cygwin-owner On Behalf Of Lipin, Adam
> Sent: 13 April 2004 15:44

> The problem isn't calling bash. I can call bash without a problem. The

> problem is that I call bash then it executes bash and gives me a 
> prompt and then stops. It does not run any commands after executing 
> bash. Whether I run bash.bat or bash.exe.

  In fact, that's exactly what you'd expect, come to think of it.  When
cmd.exe processes a command in a batch file, it doesn't redirect the
contents of the batch file into the stdin for that command.  It executes
the command program and waits for it to complete before reading more of
the batch file.  You wouldn't expect this to work, would you:

-----wont_work.bat-----
notepad.exe
Hello, this will NOT end up as text in the notepad document
-----wont_work.bat-----

  cmd.exe doesn't understand that bash.exe is a command shell, it just
treats it like any other program that's called from a batch file, and in
particular it doesn't pipe any input to it, from the batch file or
anywhere else.

  To get the effect you want, you should really put the bash commands
into a separate file and then use "bash -s < filename" (or even "cat
filename | bash -s" I suppose).  If you want to keep things localized in
the one file, you could use echo instructions to build a temporary
script file.  It's a shame that cmd.exe doesn't support here docs.


    cheers, 
      DaveK
-- 
Can't think of a witty .sigline today....


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



**** Important Notice to Recipients ****
It is important that you do not use e-mail to request, authorize or effect the purchase or sale of any security or commodity, to send fund transfer instructions, or to effect any other transactions. Any such request, orders, or instructions that you send will not be accepted and will not be processed by Morgan Stanley.
****************************************

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



More information about the Cygwin mailing list