Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Strange behavior with "for i in .."
- X-seq: zsh-users 16405
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Volodya Khomchak <kolombo.inc@xxxxxxxxx>
- Subject: Re: Strange behavior with "for i in .."
- Date: Fri, 23 Sep 2011 12:41:40 +0200
- Cc: zsh-users@xxxxxxx
- 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=
- In-reply-to: <4E7C5F9D.2070308@gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <4E7C5F9D.2070308@gmail.com>
On 23 September 2011 12:29, Volodya Khomchak <kolombo.inc@xxxxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author