* Bug (?) with ${(M)NAME:+WORD} and ${(P)NAME}
@ 2023-01-23 20:45 Bart Schaefer
2023-01-24 9:41 ` Mikael Magnusson
0 siblings, 1 reply; 2+ messages in thread
From: Bart Schaefer @ 2023-01-23 20:45 UTC (permalink / raw)
To: Zsh hackers list
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?
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Bug (?) with ${(M)NAME:+WORD} and ${(P)NAME}
2023-01-23 20:45 Bug (?) with ${(M)NAME:+WORD} and ${(P)NAME} Bart Schaefer
@ 2023-01-24 9:41 ` Mikael Magnusson
0 siblings, 0 replies; 2+ messages in thread
From: Mikael Magnusson @ 2023-01-24 9:41 UTC (permalink / raw)
To: Bart Schaefer; +Cc: Zsh hackers list
On 1/23/23, Bart Schaefer <schaefer@brasslantern.com> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-01-24 9:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-23 20:45 Bug (?) with ${(M)NAME:+WORD} and ${(P)NAME} Bart Schaefer
2023-01-24 9:41 ` Mikael Magnusson
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).