delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/12/09/21:57:06

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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.20041209215508.009f61b0@mailexpress.ica.net>
X-Sender: asun AT sayeh DOT ca@mailexpress.ica.net (Unverified)
Date: Thu, 09 Dec 2004 21:55:57 -0500
To: cygwin AT cygwin DOT com
From: Andy Sun <asun AT sayeh DOT ca>
Subject: running a DOS batch file from a shell script - script doesn't wait for batch file to complete before continuing
Mime-Version: 1.0

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

My last resort is to exercise file locking, i.e. create a stub file at the 
beginning of the DOS
batch file and remove it at the end, and have a while loop in the shell 
script detecting the
removal of the stub file before continuing. However, I want to find out if 
there is anything
else I either did wrong or not aware of (frankly, I never imagine that I 
will be running a
Unix shell script in a Windows environment to call up a DOS batch file one 
day!). Any
info and pointer will be much appreciated.

Andy


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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019