delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/05/18/14:06:09

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.0 required=5.0 tests=AWL,BAYES_20,SPF_HELO_PASS,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: "C. Woody Butler" <charles DOT butlerjr AT constellation DOT com>
Subject: Re: trying to get the process id for a spawned process to wait for it
Date: Wed, 18 May 2011 18:05:24 +0000 (UTC)
Lines: 39
Message-ID: <loom.20110518T193822-520@post.gmane.org>
References: <loom DOT 20110517T203754-549 AT post DOT gmane DOT org> <4DD40377 DOT 80600 AT ece DOT cmu DOT edu>
Mime-Version: 1.0
User-Agent: Loom/3.14 (http://gmane.org/)
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
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

Ryan Johnson <ryanjohn <at> ece.cmu.edu> writes:

> 
> What shell are you using? In bash, at least, the above won't work -- you 
> want Jobs=((Jobs+1))
> 
> Just to be sure, you've confirmed that the problem arises because the 
> if-then body runs with an empty $PID? Do the two echo commands fire?
> 
> Ryan
> 
> 

bash

the $Jobs thing works fine (surprised me actually 
but I went with it - I'm not a beginner programmer 
but I'm fairly new to BASH scripting, and this was my 
first attempt at doing math  ).

yes, the echoes fire, and the $PID is blank. 
that echo just says "is the process".

BUT --

And I just ran it to make sure I wasn't crazy, 
and apparently I was because now it's working 
beautifully. And unless the CYGWIN gremlin changed 
it it's still the same code I posted.

And it still adds right.

Sooo - thanks. I'm crazy, it works as advertised, 
and all's right with the world. 

Yay.

--woody



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

- Raw text -


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