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

Re: Zsh's and ksh's bang (!) expansion flags have different meanings



On Sun, Jul 19, 2026 at 8:51 AM Philippe Altherr <philippe.altherr@xxxxxxxxx> wrote:
Another difference is that in Zsh the (k) flag doesn't work for array ranges ("${(k)arr[*]}" returns "aa bb cc"), while in ksh it does ("${!arr[*]}" returns "0 1 2"). To me, this looks like something that ought to be changed in Zsh.

This is very difficult because zsh always passes parameter replacements around by value rather than by reference.  By the time the parameter expansion stack unwinds to the place where it might want keys, the keys are gone and all that's left is an array of values.


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