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 Message-Id: <5.1.0.14.1.20041209225754.00a09270@mailexpress.ica.net> X-Sender: asun AT sayeh DOT ca@mailexpress.ica.net Date: Thu, 09 Dec 2004 23:22:54 -0500 To: Cygwin List From: Andy Sun Subject: Re: running a DOS batch file from a shell script - script doesn't wait for batch file to complete before continuing In-Reply-To: <6.2.0.14.0.20041209222320.04d5ceb8@pop.prospeed.net> References: <5 DOT 1 DOT 0 DOT 14 DOT 1 DOT 20041209215508 DOT 009f61b0 AT mailexpress DOT ica DOT net> <5 DOT 1 DOT 0 DOT 14 DOT 1 DOT 20041209215508 DOT 009f61b0 AT mailexpress DOT ica DOT net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed I guess I should have been more specific with my original posting... I was running pro_batch in command-line mode (pro_batch -text ...) and not interactive mode, i.e. not using the GUI at all. I thought it was implied since I was talking about running a shell script and a batch file. The shell script actually constructs the command-line and input file automatically and then kicks off the DOS batch file. The script is supposed to monitor to contents of the file pro_batch.log.1 afterwards but it started to parse the file contents even before the DOS batch file is completed. If I forced a long wait by adding a "sleep 300" after the DOS batch file command, parsing was done properly. However, I cannot set a fix wait time as it depends on the complexity of the Pro/E assembly. You are correct in that the pro_batch interactive mode does work. Andy At 22:26 12/09/04 -0500, you wrote: >At 09:55 PM 12/9/2004, you wrote: > >Hi, > > > >I have a shell script (#!/bin/sh) that runs a DOS batch file. During the > execution of the shell script, > >it runs the DOS batch file (Pro/ENGINEER's PRO_BATCH.BAT to generate a > plot file) but the > >script does not appear to wait for the DOS batch file to finish first > before continuing. > > > >I tried running the DOS batch file using another shell (/bin/sh -c > file.bat) within the script, > >use "wait" right after the batch file line to wait for the process to > complete first but none of > >them seem to work. I've also searched the web for answers with no avail. > It looks like > >once the DOS batch file starts to execute, it is not possible to > exercise job control on the > >cygwin unix side. The versions of my Cygwin and Windows are: > > > >Cygwin version: CYGWIN_NT-5.1 1.5.9 (0.112/4/2) > >OS version: Windows XP Professional Version 2002 w/ Service Pack 1 > > >The following worked fine for me: > >#!/bin/sh >/pro/proE/bin/pro_batch.bat > >This is with the latest Cygwin (1.5.12) and W2K. > >The version of Pro/E is a bit out of date but it still popped up the GUI >and sat there waiting for me to do something. The shell script didn't >exit until I terminated the program/bat file. > >YMMV, > > >-- >Larry Hall http://www.rfk.com >RFK Partners, Inc. (508) 893-9779 - RFK Office >838 Washington Street (508) 893-9889 - FAX >Holliston, MA 01746 -- 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/