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

Re: Associative array, brace-free subscripting: key with spaces



On Thu, 29 Oct 2015 13:17:17 -0400
Clint Hepner <clint.hepner@xxxxxxxxx> wrote:
> Consider the array
> 
>     typeset -A b
>     b=("a b c" d)
> 
> The following correctly expands to "d"
> 
>     ${b[a b c]}
> 
> but this results in a "bad subscript" error:
> 
>     $b[a b c]

Without the surrounding brace, the spaces separate words, so it looks at
"$b[a" and doesn't like it.

pws



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