From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27145 invoked by alias); 23 Sep 2011 10:41:56 -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: 16405 Received: (qmail 26685 invoked from network); 23 Sep 2011 10:41:45 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.212.43 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=/JFR7+V7JgEyRcd6tVd+05AuQFxabMLqWL+B11E/rcs=; b=lIlL4eRCa/wfbrMY54V0Nrj7T16yKMfXfFFDrkQ/BkrCTR1MVHpeJUzBdSBopWngvk dzeHQ7gYI6m8XPnbQc29J4FxR0utupyP7af5JdeX4lplejWV0gtSodAJOHlwIeiGQ1c7 +ys/F4fAqHtWkxZV54pe36aHWKkbmeODs758g= MIME-Version: 1.0 In-Reply-To: <4E7C5F9D.2070308@gmail.com> References: <4E7C5F9D.2070308@gmail.com> Date: Fri, 23 Sep 2011 12:41:40 +0200 Message-ID: Subject: Re: Strange behavior with "for i in .." From: Mikael Magnusson To: Volodya Khomchak Cc: zsh-users@zsh.org Content-Type: text/plain; charset=UTF-8 On 23 September 2011 12:29, Volodya Khomchak wrote: > Hi, > > I faced with strange behavior with "for i in ..". > So the problem is next: > # for i in /etc/profile.d/*.sh;do echo $i;done > # zsh: bad math expression: operand expected at `/etc/profi...' > But if I change "i" to "file" it would work: > # for file in /etc/profile.d/*.sh;do echo $file;done > # /etc/profile.d/1.sh > # /etc/profile.d/2.sh > > zsh --version > zsh 4.3.10 (x86_64) > > So what is going on here ? At some point you've done 'integer i', so when you assign to i it will be evaluated as a math expression. Try "echo ${(t)i}". "unset i" before the loop should fix it. -- Mikael Magnusson