zsh-users
 help / color / mirror / code / Atom feed
From: Pier Paolo Grassi <pierpaolog@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Vin Shelton <acs@alumni.princeton.edu>,
	 Peter Stephenson <p.w.stephenson@ntlworld.com>,
	Zsh-Users List <zsh-users@zsh.org>
Subject: Re: Most Recent File
Date: Sun, 24 Oct 2021 02:24:04 +0200	[thread overview]
Message-ID: <CAP+y1xC3Dx74sBaCf8mgmEcOMh+hUH6zAdt236k=JTjw4-cBqQ@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7Zhj_+3jaDQLvx5Y6mCwb0T7QV6x+yygaZm84hacez5cQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1384 bytes --]

>That doesn't work because if one of the file names has a newline in
>it, (f) will split it into two words.  (Also I think you left out an
>open paren.)

sorry about that, I haven't ever considered newlines in filenames, since I
wouldn't put them in the first place. Of course that's not to say that
cannot happen anyway, of course.
And yes, it should have been:

ls "${(f)$(recent 3)}"

thanks for catching that

Pier Paolo Grassi


Il giorno dom 24 ott 2021 alle ore 00:42 Bart Schaefer <
schaefer@brasslantern.com> ha scritto:

> On Sat, Oct 23, 2021 at 1:57 PM Pier Paolo Grassi <pierpaolog@gmail.com>
> wrote:
> >
> > and use it like this:
> >
> > ls "${(f)$recent 3)}"
>
> That doesn't work because if one of the file names has a newline in
> it, (f) will split it into two words.  (Also I think you left out an
> open paren.)
>
> print -lr -- ${(q)f}
>
> and then
>
> eval ls -ld $(recent 3)
>
> seems to be the closest thing.
>
> > Il giorno sab 23 ott 2021 alle ore 22:44 Vin Shelton <
> acs@alumni.princeton.edu> ha scritto:
> >>
> >> What am I doing wrong?  Does quoting not work correctly in captured
> output?
>
> The trouble is that "ls" doesn't interpret the quoting, when $(...)
> preserves it.  So you have to emit the quotes in a form that the shell
> can interpret, and then use "eval" to make that happen.
>
> For extra safety, you could use ${(qqqq)f} instead.
>

[-- Attachment #2: Type: text/html, Size: 2284 bytes --]

  reply	other threads:[~2021-10-24  0:25 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-23 16:15 Vin Shelton
2021-10-23 16:43 ` Dominik Vogt
2021-10-23 16:58   ` Peter Stephenson
2021-10-23 17:24     ` Dominik Vogt
2021-10-23 17:32       ` Peter Stephenson
2021-10-23 18:39         ` Bart Schaefer
2021-10-23 19:07         ` Vin Shelton
2021-10-23 19:26           ` Bart Schaefer
2021-10-23 20:43             ` Vin Shelton
2021-10-23 20:56               ` Pier Paolo Grassi
2021-10-23 22:42                 ` Bart Schaefer
2021-10-24  0:24                   ` Pier Paolo Grassi [this message]
2021-10-24  0:32                     ` Paul
2021-10-24  1:45                       ` Dominik Vogt
2021-10-24  7:22                         ` Roman Perepelitsa
2021-10-25 19:45                           ` Disabling null elision (was: Re: Most Recent File) Daniel Shahaf
2021-10-25 20:02                             ` Roman Perepelitsa
2021-10-25 20:41                               ` Daniel Shahaf
2021-10-25 21:00                                 ` Ray Andrews
2021-10-25 21:09                                   ` Bart Schaefer
2021-10-25 21:05                                 ` Bart Schaefer
2021-10-25 21:20                                 ` Roman Perepelitsa
2021-10-25 20:05                             ` Bart Schaefer
2021-10-24  1:37                     ` Most Recent File Dominik Vogt
2021-10-23 16:47 ` david rayner
2021-10-23 16:54   ` Vin Shelton
2021-10-23 16:51 ` david rayner

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='CAP+y1xC3Dx74sBaCf8mgmEcOMh+hUH6zAdt236k=JTjw4-cBqQ@mail.gmail.com' \
    --to=pierpaolog@gmail.com \
    --cc=acs@alumni.princeton.edu \
    --cc=p.w.stephenson@ntlworld.com \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    --subject='Re: Most Recent File' \
    /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

Code repositories for project(s) associated with this 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).