Zsh Mailing List Archive
Messages sorted by:
Re: strange arithmetic
- X-seq: zsh-users 1166
- From: Louis-David Mitterrand <mito@xxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxxxxxxx
- Subject: Re: strange arithmetic
- Date: Sat, 29 Nov 1997 09:40:41 -0500
- In-reply-to: <19971128200444.42485@xxxxxxxxxxxx>; from Dan Nelson on Fri, Nov 28, 1997 at 08:04:44PM -0600
- References: <19971128140924.07137@retriever> <347F26A5.BBB84546@xxxxxxxxxxxxx> <19971128153022.58317@retriever> <19971128200444.42485@xxxxxxxxxxxx>
- Reply-to: mito@xxxxxxxxxxx
On Fri, Nov 28, 1997 at 08:04:44PM -0600, Dan Nelson wrote:
> In the last episode (Nov 28), Louis-David Mitterrand said:
> > > > % i=0;while ! [[ $[++i] < 900 ]];do;echo $i;done
> > > > % 1
> > > > % 2
> > > > [...]
> > > > % 90
> > > >
> > > > Is this normal?
> > Thanks to you and zefram, I guess I've been exposed to Perl for a little
> > too long (the time I could put off learning shell scripting ;-).
> > And to think I thought I had discovered a bug in mighty zsh ..
> I'm not sure what Perl has to do with your confusion, unless Perl uses
> [[ .. ]] to signify arithmetic evaluation? I'd check the Perl man
> pages, but as they are split into 35 (!!!!!) sections, I won't. Thank
> goodness for "man zshall".
> I think [[ ]] is a builtin version of the test command, with more
> testing capabilities.
> You probably wanted to use the (( )) construct in zsh, to do arithmetic
> evaluation of your test.
Aha! Right. I hadn't ventured deep engough in zsh's man pages. Sorry for
taking bandwidth with "should have RTFM'd" questions.
Right now I'm trying to understand bitwise manipulations and every day
that passes I thanks zsh for being such a wonderful prototyping tool. No
need to compile stuff, just type away and here comes the result... The
$[2#10010101] stuff comes real handy there to understand binary format.
Again, congratulations to zsh's developers. It's an awesome concentrate
of intelligence sitting behind that modest '%' prompt.
Messages sorted by: