zsh-users
 help / color / mirror / code / Atom feed
From: Roman Perepelitsa <roman.perepelitsa@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Ray Andrews <rayandrews@eastlink.ca>, Zsh Users <zsh-users@zsh.org>
Subject: Re: nesting issue
Date: Sun, 5 May 2024 07:40:00 +0200	[thread overview]
Message-ID: <CAN=4vMqF=z7rs75BMQy+baKXgHO0EtiEq6eN5jQ1b-LGXTKvUg@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7aqkafqXHReUU2iOhAoOFbwBbdoFyuBWTOTnRM6xiEM3g@mail.gmail.com>

On Sun, May 5, 2024 at 5:21 AM Bart Schaefer <schaefer@brasslantern.com> 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.


  parent reply	other threads:[~2024-05-05  5:41 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-04 19:36 Ray Andrews
2024-05-05  3:20 ` Bart Schaefer
2024-05-05  5:39   ` Lawrence Velázquez
2024-05-05  5:40   ` Roman Perepelitsa [this message]
2024-05-05 13:52     ` Ray Andrews
2024-05-05 20:14       ` Lawrence Velázquez
2024-05-05 22:18         ` Ray Andrews
2024-05-05 23:26           ` Lawrence Velázquez
2024-05-06  1:51             ` Ray Andrews
2024-05-06  3:22               ` Bart Schaefer
2024-05-06 13:01                 ` Ray Andrews
2024-05-06  3:43               ` Lawrence Velázquez
2024-05-06 13:09                 ` Ray Andrews
2024-05-05 13:13   ` Ray Andrews
2024-05-05 19:44     ` Lawrence Velázquez
2024-05-05 20:14       ` Ray Andrews
2024-05-05 20:45         ` Lawrence Velázquez
2024-05-05 22:22           ` Ray Andrews

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAN=4vMqF=z7rs75BMQy+baKXgHO0EtiEq6eN5jQ1b-LGXTKvUg@mail.gmail.com' \
    --to=roman.perepelitsa@gmail.com \
    --cc=rayandrews@eastlink.ca \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).