Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: spaces in filenames should be a crime.

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.


Messages sorted by: Reverse Date, Date, Thread, Author