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

Re: nesting issue



On Sun, May 5, 2024 at 5:21 AM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> local sorted=( "${(f)$(print -l "${(n)in[@]}")}" )
>
> I'm not going into whether that produces the result that you intend.

My guess is that it almost certainly does not produce the result Ray
intended. This might though:

    local sorted=( $1,*(nN) )

The difference can be observed in the following cases:

- Nothing matches $1,*.
- $1 starts with a dash.
- At least one element of $1,* contains a newline.
- At least one element of $1,* contains a C style escape sequence.

I think it unlikely that in any of these cases the results produced by
the variant with the print are desired.


Roman.




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