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

Re: Typeset with array



Peter wrote:
> Oliver Kiddle <okiddle@xxxxxxxxxxx> wrote:
> > Similarly: typeset -i foo=(23)
> 
> I decided to make these errors --- the user is in a good position to do
> the right thing here since it's staring them in the face and fixing
> things up in typeset by guessing what the user actually meant is (you
> can trust me on this :-/) very messy, so I think this is reasonable.

Sounds fair enough, however, in the case of something like:
  % typeset -i i=(2+3)*4
  zsh: no matches found: *4
it isn't exactly staring you in the face.

Both bash and ksh allow math expressions starting with parentheses.
They do different things in this case:
  typeset -i bob
  one=5
  typeset bob=(one)
  echo $bob

Also, note the following:
  typeset var1=(one two)var2=three
Bash treats that as a string assignment. Zsh and ksh consider that to be
two separate assignments. That's also true without the typeset. That
seems reasonable.

This is not new but what is going on here?:
 % var=x(
 >
That's a PS2 prompt where %_ is nothing.

Oliver



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