delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/07/12/04:48:27

X-Spam-Check-By: sourceware.org
Message-ID: <44B4B74A.1050500@gmail.com>
Date: Wed, 12 Jul 2006 09:48:10 +0100
User-Agent: Mozilla Thunderbird 1.0.7 (X11/20050923)
MIME-Version: 1.0
To: prz <Guy DOT Przytula AT riziv DOT fgov DOT be>
CC: cygwin AT cygwin DOT com
Subject: Re: variable after break
References: <5283821 DOT post AT talk DOT nabble DOT com>
In-Reply-To: <5283821.post@talk.nabble.com>
From: Dave <kilroyd AT googlemail DOT com>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
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

prz wrote:
> I am using a simple program with a loop
<snip>
> when getting out of the loop with break the variable $aid gets cleared
> it was printed before the break and getting out of the loop
> Any idea / hint ?

I don't believe this is cygwin specific. Have a read of the bash man page.

Hint: Not only are you reading the variable outside the loop in which 
you first declare it, you're also reading it outside the group command.

 From my reading of your command you shouldn't need to call grep, gawk, 
and use a while loop to match another string. gawk should be able to do 
everything for you. info gawk.

Dave.

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