Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Zsh's and ksh's bang (!) expansion flags have different meanings
- X-seq: zsh-workers 55014
- From: Stephane Chazelas <stephane@xxxxxxxxxxxx>
- To: Philippe Altherr <philippe.altherr@xxxxxxxxx>
- Cc: "Mark J. Reed" <markjreed@xxxxxxxxx>, Mikael Magnusson <mikachu@xxxxxxxxx>, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: Zsh's and ksh's bang (!) expansion flags have different meanings
- Date: Tue, 21 Jul 2026 18:27:27 +0100
- Archived-at: <https://zsh.org/workers/55014>
- In-reply-to: <CAGdYchtH3T9V+y9jguM5AZz_taXCKYhkgMCP2stbDKvLMvP75A@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- Mail-followup-to: Philippe Altherr <philippe.altherr@xxxxxxxxx>, "Mark J. Reed" <markjreed@xxxxxxxxx>, Mikael Magnusson <mikachu@xxxxxxxxx>, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, Zsh hackers list <zsh-workers@xxxxxxx>
- References: <CAGdYchvRE_B4b0yuk9drdR3dKb-2ci5r9PC5mUsVQ=x8tm2-1g@mail.gmail.com> <CAH+w=7Zd1Ov6XHYom1Ybs5oSujPyUTzX4213dMP968L53O7WEw@mail.gmail.com> <CAGdYchsKwb=Rpx9Rgv0yACZvjbFHSFjq-QmLY701UeCY9=PRzA@mail.gmail.com> <CAH+w=7aq63XvQkXi3-JDHi+F91Xj_ei7Dpg9jT65jaoj5ZkOPw@mail.gmail.com> <CAHYJk3Tk_p=XKej2X=oBcXa52hfsrc5WLQbUf7hF-pkGkyFiwQ@mail.gmail.com> <CAA=-s3z1ShDuw+JnGg5YHDHmEdR8T5pfW_PBdrnCX9CGYL=G4A@mail.gmail.com> <CAGdYchtH3T9V+y9jguM5AZz_taXCKYhkgMCP2stbDKvLMvP75A@mail.gmail.com>
2026-07-21 16:27:08 +0200, Philippe Altherr:
> >
> > >>> 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".
>
>
> Funny, I always assumed it was (k)ey (and (v)alue). Good thing that both
> ksh and key start with the same letter :-)
[...]
Me too and https://www.zsh.org/mla/workers/1998/msg00922.html
in design discussion for associative arrays would seem to
corroborate that.
Looking at git history, it seems those flags were added in
https://sourceforge.net/p/zsh/code/ci/d2330ba0554b09a3f942a921acfbbabcf6466bef/#diff-5
but not mentioned in changelog and apparently bundled with the
changes for https://www.zsh.org/mla/workers/2000/msg01372.html
by pws.
--
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author