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 Thu, Jul 23, 2026 at 7:42 AM Philippe Altherr <philippe.altherr@xxxxxxxxx> wrote:

I highlighted in orange the results where Zsh does something similar (return the index/key) but not in the exact same way as ksh (Zsh returns just the index/key, while ksh returns the full parameter spec).

The zsh behavior is what makes hash2=( "${(@kv)hash1}" ) work for copying one hash to another.

Somewhat related, until relatively recently, zsh did not support the `var=( [1]=first [2]=second )` assignment syntax.

As I've mentioned in the past, if you see ksh-like behavior in zsh that doesn't quite match ksh, it's often because the ksh behavior was implemented based on reading examples from the ksh manual pages way back when ksh was proprietary software and unavailable for running a comparison.

Other times it's because the ksh behavior or syntax conflicted with something else zsh was already doing.


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