Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Globbing symlinks-to-${glob_qualifier}
Lawrence Velázquez wrote on Thu, Aug 19, 2021 at 00:38:11 -0400:
> % printf '<%s>' *(@-/); echo
> <a><b><c><d>
That's also an answer to Zach's upthread point about how to print
a glob's expansion exactly. This solution is POSIX, but can be
ambiguous if the arguments contain «>» or «<» characters. Alternatives
include:
% () { typeset -p argv } 'foo bar' '' 'baz'
typeset -g -a argv=( 'foo bar' '' baz )
% () { print -raC1 -- "${(q-)@}" } 'foo bar' '' 'baz'
'foo bar'
''
baz
% () { print -raC1 -- "${(qqqq)@}" } 'foo bar' '' 'baz'
$'foo bar'
$''
$'baz'
The examples use anonymous functions for self-containedness, but feel
free to copy a function to your dotfiles and name it.
The test values test for word splitting and null elision.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author