Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com From: "Dave Korn" To: Subject: RE: Does anyone know how to invoke a bash process via a dos batch program so commands after bash execute? Date: Tue, 13 Apr 2004 16:02:43 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit In-Reply-To: Message-ID: X-OriginalArrivalTime: 13 Apr 2004 15:02:44.0390 (UTC) FILETIME=[5FFC4460:01C42168] > -----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/