From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12846 invoked from network); 21 Jun 2008 20:58:09 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00 autolearn=ham version=3.2.4 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 21 Jun 2008 20:58:09 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 99985 invoked from network); 21 Jun 2008 20:58:05 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 21 Jun 2008 20:58:05 -0000 Received: (qmail 4202 invoked by alias); 21 Jun 2008 20:58:02 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25230 Received: (qmail 4188 invoked from network); 21 Jun 2008 20:58:01 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 21 Jun 2008 20:58:01 -0000 Received: from po-out-1718.google.com (po-out-1718.google.com [72.14.252.157]) by bifrost.dotsrc.org (Postfix) with ESMTP id D741B80524FD for ; Sat, 21 Jun 2008 22:57:58 +0200 (CEST) Received: by po-out-1718.google.com with SMTP id c31so14687776poi.1 for ; Sat, 21 Jun 2008 13:57:57 -0700 (PDT) Received: by 10.141.133.14 with SMTP id k14mr9961261rvn.127.1214081875531; Sat, 21 Jun 2008 13:57:55 -0700 (PDT) Received: by 10.151.110.1 with HTTP; Sat, 21 Jun 2008 13:57:55 -0700 (PDT) Message-ID: Date: Sat, 21 Jun 2008 17:57:55 -0300 From: "Joey Mingrone" To: zsh-workers@sunsite.dk Subject: scope of variables in loops MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: ClamAV 0.92.1/7529/Sat Jun 21 21:13:43 2008 on bifrost X-Virus-Status: Clean Hello, Unlike bash, parameters that are set in loops on the command line stick around. It's not a big deal once you figure out what's going on, but the code below can cause some head-scratching. Is this intended? Is it controllable (is there a way to turn it off)? Thanks, Joey zsh 4.3.6 (i386-portbld-freebsd7.0)% for ((x=0; x<=10; x++)) do echo "$x"; done 0 1 2 3 4 5 6 7 8 9 10 zsh 4.3.6 (i386-portbld-freebsd7.0)% for y in `ls *`; do echo $y; done .Xauthority .Xmodmap .aspell.en.prepl ... ... zsh 4.3.6 (i386-portbld-freebsd7.0)% for x in `ls *`; do echo $x; done zsh: bad floating point constant zsh 4.3.6 (i386-portbld-freebsd7.0)% unset x zsh 4.3.6 (i386-portbld-freebsd7.0)% for x in `ls *`; do echo $x; done 0 1 2 3 4 5 6 7 8 9 10