Zsh Mailing List Archive
Messages sorted by:
Re: <> doesn't sort numerically
- X-seq: zsh-workers 607
- From: Peter William Stephenson <pws@xxxxxx>
- To: steve@xxxxxxxxxxxx (Steven L. Baur)
- Subject: Re: <> doesn't sort numerically
- Date: Tue, 14 Nov 1995 11:06:39 +0100
- Cc: zsh-workers@xxxxxxxxxxxxxxx (Zsh hackers list)
- In-reply-to: "steve@xxxxxxxxxxxx"'s message of "13 Nov 1995 10:29:51 MET." <m2ivkoqsf4.fsf@xxxxxxxxxxxxxxxxxx>
> Peter> Perhaps it's actually a bit counterintuitive. Would it
> Peter> actually be more sensible for <> always to produce globbing
> Peter> in numerical order? I haven't looked at the source but
> Peter> presumably it's not too hard.
> Yes. Especially since a semi-clueless person could always bruteforce
> the current behavior with $(ls <>). Although, I suppose, the same
> could be said for $(sort -n <>).
I'm inclined to agree. Unfortunately, I've looked at the source and
it's not that easy: the code for <> just checks for a number and adds
the file name to the list, while sorting of names happens altogether
at the end. I'll try and think of a way of doing it. I doubt if it's
worth rewriting the code to order the files as we go along just to
As you mentioned, the manual doesn't talk about NUMERIC_GLOB_SORT in
the globbing section, which is a mistake. Here's an addition.
*** Doc/zshexpn.1.num Tue Nov 7 04:44:02 1995
--- Doc/zshexpn.1 Tue Nov 14 11:02:41 1995
*** 376,381 ****
--- 376,386 ----
matches the files "." or "..". In other instances of pattern
matching, the / and . are not treated specially.
+ Normally, sorting occurs in straightforward lexical order. However,
+ if the option \fBNUMERIC_GLOB_SORT\fP is set, any numbers contained
+ within a pattern. however matched, will be sorted numerically. This
+ does not affect the ordering of separate words on the command line.
Peter Stephenson <pws@xxxxxx> Tel: +49 33762 77366
WWW: http://www.ifh.de/~pws/ Fax: +49 33762 77330
Deutches Electronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, 15735 Zeuthen, Germany.
Messages sorted by: