Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Most Recent File
On Sat, Oct 23, 2021 at 1:57 PM Pier Paolo Grassi <pierpaolog@xxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxxx> 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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author