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 27385
- From: Lawrence Velázquez <larryv@xxxxxxx>
- To: "Vincent Bernat" <bernat@xxxxxxxx>
- Cc: zsh-users@xxxxxxx
- Subject: Re: (z) expansion flag do not always return an array
- Date: Mon, 29 Nov 2021 11:50:38 -0500
- Archived-at: <https://zsh.org/users/27385>
- In-reply-to: <m3k0grdlls.fsf@luffy.cx>
- List-id: <zsh-users.zsh.org>
- References: <m3k0grdlls.fsf@luffy.cx>
On Mon, Nov 29, 2021, at 10:31 AM, Vincent Bernat wrote:
> The (z) expansion flag is documented to return an array
Is it? The 5.8 man page does not mention "array" even once.
z Split the result of the expansion into words using shell
parsing to find the words, i.e. taking into account any
quoting in the value. Comments are not treated specially but
as ordinary strings, similar to interactive shells with the
INTERACTIVE_COMMENTS option unset (however, see the Z flag
below for related options)
Note that this is done very late, even later than the `(s)'
flag. So to access single words in the result use nested
expansions as in `${${(z)foo}[2]}'. Likewise, to remove the
quotes in the resulting words use `${(Q)${(z)foo}}'.
--
vq
Messages sorted by:
Reverse Date,
Date,
Thread,
Author