Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: brace expansion in array subscript
On Jul 27, 2:57pm, Rory Mulvaney wrote:
}
} echo ${arr[{2,5}]}
}
} Why doesn't that get expanded into "echo ${arr[2]} ${arr[5]}"?
Array subscripts are already a comma-separated pair of arithmetic
expressions (or a quoted string value for associative arrays), and
curly braces already have their own special meaning in parameter
expansion expressions. The syntax for brace expansion doesn't fit
well here.
} It seems there would be lots of convenient uses of this feature.
If you really need it, you can get it this way:
echo ${(e):-\${arr[{2,5}]}}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author