delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/05/09/16:31:18

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
Date: Fri, 9 May 2003 16:31:06 -0400 (EDT)
From: lists AT m8y DOT org
X-X-Sender: nemo AT nautilus DOT m8y DOT org
To: cygwin AT cygwin DOT com
Subject: Bash scripting broken under Cygwin?
Message-ID: <Pine.LNX.4.53.0305091624180.10488@nautilus.m8y.org>
MIME-Version: 1.0

$ cat temp.txt | while read f;do grep -A2 '$Log' $f | grep -q derek;if [ $? -eq "0" ];then echo $f;fi;done

This oneliner, for example, reads a list of files, does a grep for something I'm interested in, and echos the file if found.

Under Cygwin, I have verified invalid responses. 


It seems to be because $? is the exit status of the last command, but according to the process list, Cygwin seems to run the greps in background, at once.  I've never been able to get this to happen on other unixes I've tried similar loops on. 


Is this supposed to be a performance inhancement?  It really messes up simple scripts.

Cygwin was installed on this computer back at:
2002/11/06 11:50:52 Starting cygwin install, version 2.249.2.5

Can include the full log if people want more version numbers.

Thanks,
Derek

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