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" 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: References: <4DD40377 DOT 80600 AT ece DOT cmu DOT edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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: 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 Ryan Johnson 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