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

Re: Local arrays



On Wed, 06 Feb 2013 17:41:08 +0200
Atte Peltom채ki <atte.peltomaki@xxxxxx> wrote:
> Can someone explain the following behaviour in declaring local arrays?

It's actually simpler than you suppose: you can't declare local arrays
in one go.  An expresion like:

local -a foo=(one two three)

isn't an array assignment, because arguments to local are just like any
argument to any other command (to a first approximation).  It's a
declaration with the argument "foo=(one two three)".  Normally in zsh
that parenthesised expression at the end looks like a set of glob
qualifiers, i.e. a bit like "*(.)" or something like that.  That's the
"unknown file attribute" error.

You need to split this up:

local -a foo
foo=(one two three)


pws



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