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 10:24 AM Philippe Altherr
<philippe.altherr@xxxxxxxxx> wrote:
>
> On Sun, Jul 19, 2026 at 6:36 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>>
>> You're not noticing anything new, or rather the only thing new that you're noticing is that the (!) flag exists at all.
>
> I'm fully aware that the (!) flag is a part of named references, so not already present in any released version of Zsh.

Well, yes.  The (sorry, unstated) point was that everything you said
about (k) is long-standing and (hopefully?) derivable from
documentation or FAQ.

However, if someone wants to convert those tables of differences into
a format that could be included in either the FAQ or the "Other
Differences" section of the zsh/ksh93 module documentation, it would
probably be quite useful.

>>> In ksh, the (!) flag can be used to list the keys of arrays and associative arrays. In that regard, it's closer to Zsh's (k) flag than Zsh's (!) flag

The (k) flag was originally intended to mimic ksh's ! name prefix (due
to ! colliding with history).  The character "k" was chosen as a
mnemonic for "like (k)sh".  I suppose, rather than introduce (!), I
could have extended (k) for the named reference behavior, to preserve
that similarity.  Could still try that if it seems a good idea.




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