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

Re: glob inside nested parameter expansion returns glob string



On 4/21/22, Jim <linux.tech.guy@xxxxxxxxx> wrote:
> Hi,
>
> The following two statements produce the expected results:
>
> % A=(${:-.z*(.N)})
> % A=(${A:#*(comp|hist)*})
>
> When trying to nest the two, the result is the glob statement:
>
> A=(${${:-.z*(.N)}:#*(comp|hist)*})
>
> Trying to understand why this is the case.  Could someone explain why this
> happens?
> Is there a way to nest the two?

There is a certain order that parameter expansions and globs happen
relative to eachother, nesting param expansions does not change the
order of processing. Eg, there is not really any way you can process
.z* before the outer :# happens, which will operate on the
pre-expanded string in your final combined statement. In short, no(t
as far as I know).

-- 
Mikael Magnusson




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