Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: (z) expansion flag do not always return an array
- X-seq: zsh-users 27391
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Vincent Bernat <bernat@xxxxxxxx>
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: (z) expansion flag do not always return an array
- Date: Mon, 29 Nov 2021 11:43:34 -0800
- Archived-at: <https://zsh.org/users/27391>
- In-reply-to: <m3k0grdlls.fsf@luffy.cx>
- List-id: <zsh-users.zsh.org>
- References: <m3k0grdlls.fsf@luffy.cx>
On Mon, Nov 29, 2021 at 7:31 AM Vincent Bernat <bernat@xxxxxxxx> wrote:
>
> 16:29 ❱ print -l ${${(Az)${:-word1}}[1]}
> word1
>
> But older versions of Zsh does not have that. Is there another way?
The only way I can come up with is to append a dummy extra element; instead of
${${(z)something}[1]}
use
${${(z)${:-$something \\}}[1]}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author