Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
How to substitute empty array element, or empty string
- X-seq: zsh-users 22600
- From: Sebastian Gniazdowski <psprint@xxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: How to substitute empty array element, or empty string
- Date: Wed, 22 Mar 2017 08:52:09 +0100
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
Hello,
following does not work as expected:
% a=( a "" c ); print -rl -- "${(@)a//*/x}”
x
x
% a=""; print -rl -- "${a//*/x}”
(empty line)
I guess this is inherited from // substitution. I count lines using substitution that matches (*), and it is skipping empty lines, giving wrong line number for following elements.
Is there any solution? I’ve tried (#s), (#s)(#e), *(#e) and nothing.
--
Sebastian Gniazdowski
psprint@xxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author