From: Mikael Magnusson <mikachu@gmail.com>
To: Zach Riggle <zachriggle@gmail.com>
Cc: zsh-users@zsh.org
Subject: Re: Odd behavior of quoted Zsh array subtraction
Date: Fri, 23 Jul 2021 11:51:37 +0200 [thread overview]
Message-ID: <CAHYJk3RUZU_asuveWhDt4dpcLuBcYJW8b0BP8RK6+ycb7SpTpg@mail.gmail.com> (raw)
In-Reply-To: <CAMP9c5m3XhvZdOgX=xKEHs_EDmZV8sL5rqn0V-asD6hG3RtA7w@mail.gmail.com>
On 7/23/21, Zach Riggle <zachriggle@gmail.com> 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
next prev parent reply other threads:[~2021-07-23 9:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-23 9:39 Zach Riggle
2021-07-23 9:51 ` Mikael Magnusson [this message]
2021-07-23 11:38 ` René Neumann
2021-07-23 17:34 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAHYJk3RUZU_asuveWhDt4dpcLuBcYJW8b0BP8RK6+ycb7SpTpg@mail.gmail.com \
--to=mikachu@gmail.com \
--cc=zachriggle@gmail.com \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).