From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22142 invoked by alias); 26 Mar 2017 23:11:55 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 22618 Received: (qmail 29169 invoked from network); 26 Mar 2017 23:11:55 -0000 X-Qmail-Scanner-Diagnostics: from mta02.eastlink.ca by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(24.224.136.13):SA:0(-0.7/5.0):. Processed in 2.700722 secs); 26 Mar 2017 23:11:55 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: rayandrews@eastlink.ca X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.eastlink.ca designates 24.224.136.13 as permitted sender) X-Authority-Analysis: v=2.2 cv=Mo8i0ySe c=1 sm=1 tr=0 a=3TxE0GYYoRPvB2ReGANSkw==:117 a=3TxE0GYYoRPvB2ReGANSkw==:17 a=IkcTkHD0fZMA:10 a=0AkZGwc6NNtdKPhYp88A:9 a=QEXdDO2ut3YA:10 X-EL-IP-NOAUTH: 24.207.24.151 Subject: Re: spaces in filenames should be a crime. To: zsh-users@zsh.org References: <0c1b9d89-edd0-a027-e2f1-d01c2d68fa4e@eastlink.ca> <20170326211805.GA8170@fujitsu.shahaf.local2> From: Ray Andrews Message-id: Date: Sun, 26 Mar 2017 15:41:42 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-version: 1.0 In-reply-to: <20170326211805.GA8170@fujitsu.shahaf.local2> Content-type: text/plain; charset=utf-8; format=flowed Content-transfer-encoding: 7bit On 26/03/17 02:18 PM, Daniel Shahaf wrote: Thanks all: Yes, Vadim's fix seems to be fine. Nuts, I still don't have much sense of the logic of these things. > You could replace the whole function with: > mostrecent() { ls -l -- **/*(.om[1]) } Yeah, my original was just something I found on the net and didn't bother to improve upon until it crashed and burned on a space in the directory name. I'm not surprised that our 'ls' can do it all by itself. > You can then use [1,3] to select several files. Very fine. Not forgetting to add '-U' to 'ls'. Mind, why is that needed, since the input is not redirected from some other program it seems strange to have to tell it not to resort incorrectly what has been specifically requested, no? > > Another option here is to use find -print0 with ${(0)}. That only > matter if you need to DTRT when filenames contain NL characters. > DTRT?