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: Does anyone know how to invoke a bash process via a dos batch program so commands after bash execute?


> Sent: 13 April 2004 19:33  From: Igor Pechtchanski
 
> > Does anyone know how to invoke a bash process via a dos 
> batch program so
> > commands after bash execute?
> >
Do you want to wait for bash to finish or not? See below.
..snip..


> The batch file called from a batch file is a red herring, as others
> mentioned.
Not necessarily.
It can be handy to use CALL and START if these are available in your version
of windows.
CALL won't change the described behaviour here but is useful in other
circumstances. 
Normal behaviour is to hand control to the new batch file and the original
terminates but CALL returns control to the statement following the CALL when
the CALLed batch finishes.
This the behaviour for running .bat files, .exe files (e.g. bash) seem to be
run by using an implicit CALL. i.e. CALL is only of use for .bat (and .cmd)
files.
START will create a new process for the STARTed program and the original
will continue without waiting for the second program finishes.


Batch2.bat:
@echo This is Batch 2
@echo %1

Batch1a.bat:   Control passes to batch2, never returns.
@echo off
batch2.bat test
@echo This is batch1a

Batch1b.bat:   Control passes to batch2, returns when it finishes
@echo off
call batch2.bat test
@echo This is batch1b

Batch1c.bat:   new process starts for batch2, batch1c continues immediately.
@echo off
start batch2.bat test
@echo This is batch1c

If you don't need for bash to finish here (unlikely given the example) you
can 'start bash', you can even 'start /wait bash' if you want to start a
separate process for bash and still wait for it to end.


Bill
--


This e-mail transmission is strictly confidential and intended solely
for the person or organisation to whom it is addressed. It may contain
privileged and confidential information and if you are not the intended
recipient, you must not copy, distribute or take any action in reliance
on it. If you have received this email in error, please reply to the
sender as soon as possible and delete the message. Please note that we
are able to, and reserve the right to, monitor e-mail communications
passing through our network.

The views expressed in this email are not that of the company unless
specified within the message.

The inclusion of this footnote indicates that the mail message and any
attachments have been checked for the presence of known viruses.

If you have any comments regarding our policy please direct them to
postmaster@cox.co.uk
________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com
________________________________________________________________________

--
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/


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