From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: zsh-users-return-23701-ml=inbox.vuxu.org@zsh.org X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id fe19355a for ; Wed, 3 Oct 2018 21:06:35 +0000 (UTC) Received: (qmail 6707 invoked by alias); 3 Oct 2018 21:06:23 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 23701 Received: (qmail 4524 invoked by uid 1010); 3 Oct 2018 21:06:23 -0000 X-Qmail-Scanner-Diagnostics: from aurora-borealis.phear.org by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(94.242.205.164):SA:0(-1.9/5.0):. Processed in 0.760754 secs); 03 Oct 2018 21:06:23 -0000 X-Envelope-From: eiro@phear.org X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | X-Virus-Scanned: amavisd-new at phear.org DKIM-Filter: OpenDKIM Filter v2.10.3 aurora-borealis.phear.org AB67B10699 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=phear.org; s=20180217; t=1538600775; bh=x3BD+iwRtYK86F8Lkj4hWXwn18mr290yV3bqrIzWpZg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=so27AhLyI9L36oqR8dhUed5foGfef9eoJB79PgZEWq4GGPKq+CA2wfZJ+aciTOYSv PauAsIm9ef+m6EQHWPrLEBHM88Fp+SQ+25Y2+P3mvOIqgRvjNHisfjs1sez8SwzLMp V+ke9jS4SJ7twciMxP2s+z/X2SxUZJtvhET1Jc/iSqn9uN9Q3oHj5bZzef0AZk0HJX FEQzosrxCStAwO52XNclPpSVvuTcVUojbT0MarCMsCqWD0ppGJOfNzBufvsEEFsPWV /gs8vNpKmfbhUdmp3CdJ19JrdyYgKL39kPfR4Cz/qthSrm9W+aX/95mn/Crkasw8jJ ucXSJb/5xhwgA== Date: Wed, 3 Oct 2018 23:06:14 +0200 From: Marc Chantreux To: Bart Schaefer Cc: Zsh Users Subject: Re: dangerous behavior of while in zsh 5.6 ? Message-ID: <20181003210614.GA32575@prometheus.u-strasbg.fr> References: <20181003143800.GA9162@prometheus.u-strasbg.fr> <20181003162552.GA14697@prometheus.u-strasbg.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) hello, repeat 2 print $[i++] while ((i--)) print $i > > { repeat 2 print $[i++] > > while (( i-- )) print $i > > } |sed 10 | xargs > This shows a critical missing bit of detail from your original > message: The while loop is inside a { } expression. the way i wrote it was only to demonstrate but this is another example: # grep -n . /tmp/a.zsh 1:repeat 2 print $[i++] 2:while ((i--)) 3: print $i # zsh /tmp/a.zsh | sed 10q 0 1 1 0 -1 -2 -3 -4 -5 -6 regards marc