Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: do I win the "most pointless use of ZSH" award? ;)
- X-seq: zsh-users 3850
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: Bruce Stephens <bruce@xxxxxxxxxxxxxxxxxxxx>, zsh-users@xxxxxxxxxx
- Subject: Re: do I win the "most pointless use of ZSH" award? ;)
- Date: Wed, 2 May 2001 15:56:51 -0700
- In-reply-to: <87u2339yla.fsf@xxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20010427213108.A28356@xxxxxxxxxx> <20010430124125.A2527@xxxxxxxxxxxxxxxxxxx> <20010430210517.A4840@xxxxxxxxxx> <010430151553.ZM9588@xxxxxxxxxxxxxxxxxxxxxxx> <87u2339yla.fsf@xxxxxxxxxxxxxxxxxxxx>
On May 2, 11:26pm, Bruce Stephens wrote:
> Subject: Re: do I win the "most pointless use of ZSH" award? ;)
> "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx> writes:
>
> [...]
>
> > > for (( p=0.0, q=0.0, i=0 ; p*p+q*q < 4 && i < 32 ; i++));do
>
> I couldn't get this to work for a while. It turned out one of my
> initialization scripts was setting i to an absolute pathname:
Alan's code was intended to be run as a script, not as a shell function.
To make a shell function of it, you should add:
local lines columns colour a b p q i pnew
at the top.
> zsh% i=/foo; for ((i=0; i<10; i++)) echo $i
> zsh: bad math expression: operand expected at `/foo'
>
> Is this a bug or a feature that I'm entirely missing?
It's a feature. The value of any parameter that appears in math context
is evaluated as an expression (up to a maximum recursion depth, I forget
what just now). So
i=foo/bar
((i))
is the same as
((foo/bar))
and so on for the values of `foo' and `bar'.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author