Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Bug (?) with ${(M)NAME:+WORD} and ${(P)NAME}



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