X-Spam-Check-By: sourceware.org From: "Dave Korn" To: Subject: RE: loop hanging Date: Wed, 28 Jun 2006 14:36:18 +0100 Message-ID: <009a01c69ab7$d5dd2350$a501a8c0@CAM.ARTIMI.COM> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <5084194.post@talk.nabble.com> Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Unsubscribe: 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 On 28 June 2006 14:23, prz wrote: > I have a small program that executes a command and parses the output > I can see that on many executions the program hangs. > added some debug statements and could see it is at loop iteration that we > hang > sample code > #!/cygdrive/c/Cygwin/bin/bash > db2 list db directory | { > while read DBREC > do > [[ ! -z $DEBUG ]] && echo "p6" > statements.... > [[ ! -z $DEBUG ]] && echo "p5" > done > } > the last output before hang is always p5 > Any idea/hint why this is occuring ? It must have got stuck in the read statement somehow. Can you workaround by separating it in two and using a temp file, i.e. > #!/cygdrive/c/Cygwin/bin/bash > db2 list db directory >foo.tmp > while read DBREC do > [[ ! -z $DEBUG ]] && echo "p6" > statements.... > [[ ! -z $DEBUG ]] && echo "p5" > done cheers, DaveK -- Can't think of a witty .sigline today.... -- 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/