Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Odd behavior of quoted Zsh array subtraction
- X-seq: zsh-users 26798
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Zach Riggle <zachriggle@xxxxxxxxx>
- Cc: zsh-users@xxxxxxx
- Subject: Re: Odd behavior of quoted Zsh array subtraction
- Date: Fri, 23 Jul 2021 11:51:37 +0200
- Archived-at: <https://zsh.org/users/26798>
- In-reply-to: <CAMP9c5m3XhvZdOgX=xKEHs_EDmZV8sL5rqn0V-asD6hG3RtA7w@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <CAMP9c5m3XhvZdOgX=xKEHs_EDmZV8sL5rqn0V-asD6hG3RtA7w@mail.gmail.com>
On 7/23/21, Zach Riggle <zachriggle@xxxxxxxxx> wrote:
> I'm sure there's a section of the manual that explains this.
>
> I'm also sure I don't know what section it is.
If you search for "brain damage" in the zshall manpage, you will find
it. You are in particular interested in the ordering relation between
item 5 and item 7.
> $ a=( aa bb cc dd ee )
>
> $ b=( cc )
>
> $ echo ${a:|b}
> aa bb dd ee
>
> $ echo "${a:|b}"
> aa bb cc dd ee # <-- WHAT
>
> $ echo "${(@)a:|b}"
> aa bb dd ee
>
> $ echo "${a[@]:|b}"
> aa bb dd ee
>
> All results except the first quoted expression is the expected result.
>
> Why does the marked, quoted array-subtraction result in a different
> set of values? I would expect that array operators have precedence
> over array-converted-to-scalar. Maybe this is an "outward-in"
> expansion issue?
Your expectation is simply not matching what the code does, if the
current level is double quoted then words will be joined before
history modifiers are applied.
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author