Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[BUG] With RC_EXPAND_PARAM, s:string: does not elide an empty field
- X-seq: zsh-workers 54116
- From: Vincent Lefevre <vincent@xxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [BUG] With RC_EXPAND_PARAM, s:string: does not elide an empty field
- Date: Thu, 27 Nov 2025 11:22:42 +0100
- Archived-at: <https://zsh.org/workers/54116>
- List-id: <zsh-workers.zsh.org>
- Mail-followup-to: zsh-workers@xxxxxxx
The zshexpn(1) man page says:
s:string:
[...]
For historical reasons, the usual behaviour that empty array
elements are retained inside double quotes is disabled for
arrays generated by splitting; hence the following:
line="one::three"
print -l "${(s.:.)line}"
produces two lines of output for one and three and elides the
empty field. To override this behaviour, supply the `(@)'
flag as well, i.e. "${(@s.:.)line}".
But without the (@) flag, if the RC_EXPAND_PARAM option is set,
this does not elide the empty field:
cventin% line="one::three" ; print -l "${(s.:.)line}"
one
three
cventin% setopt RC_EXPAND_PARAM
cventin% line="one::three" ; print -l "${(s.:.)line}"
one
three
cventin% echo $ZSH_VERSION
5.9
--
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Pascaline project (LIP, ENS-Lyon)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author