Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: evaluating a condition



On Sep 13, 12:35pm, Sweth Chandramouli wrote:
> Subject: Re: evaluating a condition
> On Sun, Sep 12, 1999 at 11:51:39PM +0000, Bart Schaefer wrote:
> > On Sep 12,  8:41pm, Gaspar Bakos wrote:
> > } export min=$3;export max=$4;
> > }         if (($[min]<10 && $[max]<10)) then
> >                            ^^
> > There's a metafied space here.  I think zsh is interpreting "\240$[max]" as
> > an identifier; e.g. if max=11, the identifier name is "\240\061\061".  That
> > identifier isn't defined, so it's value is 0 which is always < 10.
> 	??? what?
> 	((...)), at least according to the docs (and as implemented in ksh)
> is just another syntax for `let '...''.  all the "metafying" (actually, 
> quoting is unmetafying) does is prevent the shell from interpreting

I said there was a metafied space there:  I didn't say zsh metafied it.
There's a "\240" character there in the input; cut'n'paste that through
"cat -v" and you'll see "...10 &&M- $[max]...".  This has nothing whatever
to do with zsh's internal "metafication" process.

> > This is a danger of permitting identifiers to contain non-ascii characters.
> 	??? okay, what did you do to bart?  :)
> 	i assume you meant non-printable and not non-ascii here, though 
> technically a space is still printable.

I meant outside the range 0-127 (decimal), though technically I suppose I
actually meant outside the range 27-126.

> 	one related question that i've long wondered but never about cared 
> enough to ask: is there a difference between the $[...] and ${...} notations?

Yeah.  $[...] evaluates ... as a math expression, the same as $((...)).
So really it's completely unnecessary inside ((...)), but I didn't want to
answer too many questions at once.



Messages sorted by: Reverse Date, Date, Thread, Author