Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Most Recent File
- X-seq: zsh-users 27283
- From: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
- To: dominik.vogt@xxxxxx, Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Most Recent File
- Date: Sun, 24 Oct 2021 09:22:46 +0200
- Archived-at: <https://zsh.org/users/27283>
- In-reply-to: <YXS6sdovNFVnDAmr@gmx.de>
- List-id: <zsh-users.zsh.org>
- References: <CAP+y1xC3Dx74sBaCf8mgmEcOMh+hUH6zAdt236k=JTjw4-cBqQ@mail.gmail.com> <CF77Q0TPEKI8.1NCL83P9Z0HV3@kbvv> <YXS6sdovNFVnDAmr@gmx.de>
On Sun, Oct 24, 2021 at 3:48 AM Dominik Vogt <dominik.vogt@xxxxxx> wrote:
>
> On Sat, Oct 23, 2021 at 07:32:09PM -0500, Paul wrote:
> > recent(){
> > # Use $reply if no parameter name given
> > typeset -ga "${2:=reply}"
> > set -A "$2" *(om[1,$1])
> > }
>
> > recent 3 files; ls -ld $files
> ^^^^^^
>
> ls -ld -- "${files[@]}"
The "--" is a good addition but the other suggested changes only make
a difference if KSH_ARRAYS or SH_WORD_SPLIT is set. Neither is set in
native mode and few zsh users set them.
It's one of the nice things about zsh that you can use the shorter
$foo and $#foo instead of "${foo[@]}" and ${#foo[@]}. I wish there was
an option to disable null elision with a corresponding expansion flag
to turn it on similar to no_sh_word_split and ${(=)name}
Roman.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author