zsh-users
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: Volodya Khomchak <kolombo.inc@gmail.com>
Cc: zsh-users@zsh.org
Subject: Re: Strange behavior with "for i in .."
Date: Fri, 23 Sep 2011 12:41:40 +0200	[thread overview]
Message-ID: <CAHYJk3TO25yZBb5+Y2MdL+ENO1JEpLW4UM+Kf2-RSv9LPCKOng@mail.gmail.com> (raw)
In-Reply-To: <4E7C5F9D.2070308@gmail.com>

On 23 September 2011 12:29, Volodya Khomchak <kolombo.inc@gmail.com> 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


  reply	other threads:[~2011-09-23 10:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-23 10:29 Volodya Khomchak
2011-09-23 10:41 ` Mikael Magnusson [this message]
2011-09-23 10:51   ` Volodya Khomchak
2011-09-23 10:41 ` Peter Stephenson
2011-09-23 10:43 ` Oliver Kiddle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHYJk3TO25yZBb5+Y2MdL+ENO1JEpLW4UM+Kf2-RSv9LPCKOng@mail.gmail.com \
    --to=mikachu@gmail.com \
    --cc=kolombo.inc@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).