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

Re: ${(t!)nameref}; ${(t)${nested}}; Doc/zshall.1



Bart Schaefer wrote on Wed, 12 Nov 2025 02:22 +00:00:
> Catching up on this (and mildly surprised no one else got to these
> tidbits before me) ...
>
> On Fri, Nov 7, 2025 at 10:46 PM Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
>> C. Here, a ${(t)…} expression expands to something not (t)-ey at all:
>>
>>     % echo ${(t)${PATH}}
>>     /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
>
> That's because nested expansions work inside-out.  Once you've
> expanded ${PATH} you don't have a parameter any more; (t) is defined
> on parameters, not on values.

In that case, shouldn't ${(t)${PATH}} give an error message?

I could see that syntax expanding to "scalar" v. "array", and I could
see it giving an error message; but the user did specify (t), so we should
either do what (t) is supposed to do, or error out, surely?

Thanks,

Daniel




Messages sorted by: Reverse Date, Date, Thread, Author