X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org To: cygwin AT cygwin DOT com From: "C. Woody Butler" Subject: trying to get the process id for a spawned process to wait for it Date: Tue, 17 May 2011 18:45:23 +0000 (UTC) Lines: 33 Message-ID: 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 Hi - I'm trying to launch a set number of threads, wait for them to finish, launch another set of threads, wait and repeat until there's no more input. so - I've got this (this is in the middle of a loop reading a file): Jobs=$Jobs + 1 /tibcoresources/appmanage.exe <> & PID=$! echo $PID is the process if [[ $Jobs -gt 2 ]] then { echo pausing wait $PID Jobs=0 echo starting } fi But - I don't get anything back from $! so the wait doesn't wait and I end up launching a bunch of processes and taking down the server, etc, etc, etc. What am I doing wrong here? --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