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

Bart Schaefer <[email protected]> Sun, 19 Jul 2026 10:48:44 -0700
Newsgroups gmane.comp.shells.zsh.devel
Message-ID <CAH+w=7aq63XvQkXi3-JDHi+F91Xj_ei7Dpg9jT65jaoj5ZkOPw@mail.gmail.com>
On Sun, Jul 19, 2026 at 10:24=E2=80=AFAM Philippe Altherr
<[email protected]> wrote:
>
> On Sun, Jul 19, 2026 at 6:36=E2=80=AFPM Bart Schaefer <schaefer@brasslant=
ern.com> 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 a=
lready 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 associa=
tive arrays. In that regard, it's closer to Zsh's (k) flag than Zsh's (!) f=
lag

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.