From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18475 invoked by alias); 15 Feb 2016 18:59:42 -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: X-Seq: 21294 Received: (qmail 20950 invoked from network); 15 Feb 2016 18:59:41 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version:content-type; bh=NC50TprKVfwAf4WFBCEbPgpPNQFQE5xijJ7U8QrbDBE=; b=BKPAMZSYNbUtMcJAXRs2hWEuEUXeCr3GkvdSbWB99hutwTuVD+o7oexMHMoHtEplnK X1UdB8FQaaC5feIu3VYN5aW4rWcfSJkUIfJRRCGeqrITzJMUuUkHMVchkUcl17sXlLpU /luJyz0csW+tJ2VresRf9d0vbT0oJCfxJzqmrPrQBeKupUd0xnH8xWLyGy/yOJyiKMVB CJutVhBshjjudP3Bh5HFzKcCd07qoUczGkU4Plxpt63qaTOnsVAr31hgb54t08sRd1mh km1AqE7BWsY2BT0zJzNv+Hn6wxB+w41/NTNAX9SFBU4seQOKXDdgdXEdfdEZf9bhvUHL y76w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version:content-type; bh=NC50TprKVfwAf4WFBCEbPgpPNQFQE5xijJ7U8QrbDBE=; b=IRD2wWxFclXnLDK1jGRNdtQh7YSYJIoiOxjo24VKl35J8E3ntV74wE1q51nxo1p5W0 VAb66xkRDIYia1mB43grHm+9Bmq7hslgQYcoASoCOPnAmi8Sh8TVxgtEXIQHuFKqA6zp gXHPyKecCJFqthO3QbTjZgYGUw3avD4NLv4i9sJPzkuE4OCmFmzua5S3TVuyYpqrrwQ2 0QGgVoS75e4O7KIIz0mf0dBcqElAnd9kmBG/dlioh9x1eZl1cT94kOftkmiVQbJnMNpv 3vM7chTPDyJQ9pNx7kqXLEK2LfBxOHlc5Ns6KbfFSjQf4iPY01D9f6S3AOVGeKr+cK7r bjNg== X-Gm-Message-State: AG10YORU0iMSq4GYvyHQIM42FbQlsxMo9mMCvTVQ5q1iHhSFMBM751FMebfw+Uv+PjDQeg== X-Received: by 10.98.80.80 with SMTP id e77mr25553280pfb.126.1455562778190; Mon, 15 Feb 2016 10:59:38 -0800 (PST) From: Bart Schaefer Message-Id: <160215105957.ZM27731@torch.brasslantern.com> Date: Mon, 15 Feb 2016 10:59:57 -0800 In-Reply-To: <20160215180719.GA4146@spiegl.de> Comments: In reply to Andy Spiegl "leading zeros in for/foreach loops" (Feb 15, 7:07pm) References: <20160215180719.GA4146@spiegl.de> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Zsh Users Subject: Re: leading zeros in for/foreach loops MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Feb 15, 7:07pm, Andy Spiegl wrote: } } Can someone please explain this to me? Does this for loop do } something strange with the variable "i"? How can I avoid that? If the first assignment to an undeclared variable occurs in an arithmetic context, the variable is given numeric type (integer or float, depending on what has been assigned to it). "for (( ... ))" syntax is such a context. You can avoid this implicit declaration by explicitly declaring the variable before using it in any of your loops, e.g., "typeset i" or "declare i" or "local i" or the appropriate synonym. Or "unset i" after the loop is finished.