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

Re: Weird error message when using bash or ksh form of array initialization



On Aug 24, 12:05pm, Rocky Bernstein wrote:
}
} When I run this (erroneous?) program:
} 
}   typeset -a fd=()

Zsh does not support that syntax; typeset is a command, not a keyword,
so its arguments are parsed like normal shell words, not like parameter
assignments.

As Mikael pointed out, the above syntax defines three functions, named
"typeset", "-a", and "fd=", because the shell word "()" is a token that
denotes that a function name precedes it and a function body follows.

Quoting it as 'fd=()' like Mikael suggested would prevent the function
definition interpretation, but produces the error "can't assign initial
value for array".



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