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

Misc. substitution things



This seems like a bug:

zsh% print $(( x + "45" ))
dquote> 

It appears that (( and the first double-quote are taken as a matching
pair of quotes.  This is a recently-introduced bug, though I don't know
precisely when; 4.2.6 gives:

schaefer[501] print $(( x + "45" ))
zsh: bad math expression: operand expected at `"45" '

Less importantly, even after 24264 (of which I conceptually approve)
there is some ambiguity with the (P) flag and subscripting.

torch% a=A
torch% b=B
torch% c=C
torch% typeset -R5 x=abc
torch% print $x[3]
a
torch% print ${(P)x[3]}
C

Of course it has never really been "safe" to mix (P) and a subscript
without using a nested substitution to make your meaning clear (most
often one of ${${(@P)x}[3]} or ${(P)${x[3]}}, rarely ${${(P)x}[3]},
because quoting changes the results of that last one).

Post-24264, we're consistent with older zsh on ${(P)x[3]} but not
on ${(P)${x[3]}}.  This might be OK because ${(P)${x[3]}} in the
above example is meaningless in older zsh (because there cannot be a
parameter named "    c").



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