Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Most Recent File
On Sat, 2021-10-23 at 18:24 +0100, Dominik Vogt wrote:
> On Sat, Oct 23, 2021 at 05:58:28PM +0100, Peter Stephenson wrote:
> > f=(*(-om[1,1]))
> > print -l -- ${(q)f}
>
> Hmmmm
>
> # filename with newline:
> $ touch "c
> d"
> $ f=(c*d)
> $ echo "${(q)f}"
> c$'
> 'd
>
> Why does the value contain a '$'?
The $'...' form of quoting is a special one which can be used to quote
things that can't be quoted by backslashes. In this case, that's a
newline. Actually, a normal '<newline>' would work here, but $'...'
quoting is used for consistency with cases where that wouldn't work. If
you try it, you'll see it does indeed do the right thing.
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author