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

Re: nesting issue



On Sat, May 4, 2024 at 12:36 PM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
>
> local sorted=( "${(f)$(print -l "${(n)in[@]}") }" )
> local sorted=( "${(f)$(print -l \"${(n)in[@]}\") }" )
> local sorted=( "${(f)$(print -l ${(n)in[@]}) }" )
> local sorted=( ${(f)$(print -l ${(n)in[@]}) } )
>
>     .... none of those work.

They give "bad substitution" because you can't have a space before the
closing "}" / after the closing ")" in the parameter expansion.

local sorted=( "${(f)$(print -l "${(n)in[@]}")}" )

I'm not going into whether that produces the result that you intend.




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