Thanks, (I had tried the (q) and the extra assignment after pws suggested it) but no luck:
zsh -fnuc2% function recent {
function> local dir=
if [[ $# -gt 2 ]]; then
if [[ ! -d "$3" ]]; then
print -u2 "$0: directory \"$3\" does not exist."
return 1
fi
[[ $3 != '.' ]] && dir="$3"/fi
local f=( ${dir}${~2:-*}(-om[1,${1:-1}]) )
print -lr -- ${(@q-)f}
}
nuc2% recent 3
zsh
'Any Given Sunday.mkv'
TheEnglishPatient.mkv
nuc2% \ls -ld $(recent 3)
ls: cannot access "'Any": No such file or directory
ls: cannot access 'Given': No such file or directory
ls: cannot access "Sunday.mkv'": No such file or directory
-rw-r--r-- 1 acs acs 727146010 Oct 22 15:52 TheEnglishPatient.mkv
drwxr-xr-x 3 acs acs 3488 Oct 23 12:20 zsh
What am I doing wrong? Does quoting not work correctly in captured output?
I appreciate knowing that printf is builtin; thanks. Sorry I missed that.
- Vin