From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from math.gatech.edu (euclid.skiles.gatech.edu [130.207.146.50]) by werple.net.au (8.7/8.7.1) with SMTP id VAA24814 for ; Tue, 14 Nov 1995 21:42:40 +1100 (EST) Received: by math.gatech.edu (5.x/SMI-SVR4) id AA10000; Tue, 14 Nov 1995 05:06:13 -0500 Resent-Date: Tue, 14 Nov 1995 11:06:39 +0100 Old-Return-Path: Message-Id: <9511141006.AA09110@sgi.ifh.de> To: steve@miranova.com (Steven L. Baur) Cc: zsh-workers@math.gatech.edu (Zsh hackers list) Subject: Re: <> doesn't sort numerically In-Reply-To: "steve@miranova.com"'s message of "13 Nov 1995 10:29:51 MET." Date: Tue, 14 Nov 1995 11:06:39 +0100 From: Peter William Stephenson Resent-Message-Id: <"dSphN1.0.AS2.Ke6gm"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/607 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu steve@miranova.com wrote: > 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 achieve this. 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. .PP + 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. + .PP .RS .PD 0 .TP -- Peter Stephenson 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.