Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug (?) with ${(M)NAME:+WORD} and ${(P)NAME}
- X-seq: zsh-workers 51328
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: Bug (?) with ${(M)NAME:+WORD} and ${(P)NAME}
- Date: Tue, 24 Jan 2023 10:41:26 +0100
- Archived-at: <https://zsh.org/workers/51328>
- In-reply-to: <CAH+w=7bPY30U5Gjmk8_GjPBSkABA9OStAebWorP2y-rXPb0oBQ@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAH+w=7bPY30U5Gjmk8_GjPBSkABA9OStAebWorP2y-rXPb0oBQ@mail.gmail.com>
On 1/23/23, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> This works:
>
> () {
> local foo
> () {
> print ${(Mt)foo:#*local*}
> print ${${(Mt)foo:#*local*}:+LOCAL}
> }
> }
>
> This does not:
>
> () {
> local foo
> () {
> print ${(MtP)1:#*local*}
> print ${${(MtP)1:#*local*}:+LOCAL}
> } foo
> }
>
> No alternate nesting of (M) and (P) gives the expected result from :+
>
> The (t) there is not the issue, the same thing happens with:
>
> () {
> local foo=xx-local-xx
> () {
> print ${(MP)1:#*local*}
> print ${${(MP)1:#*local*}:+LOCAL}
> } foo
> }
>
> Am I missing something?
print ${${(Mt)${(P)1}:#*local*}:+LOCAL}
? It's weird that the case without :+ doesn't need the wrapping though...
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author