zsh-workers
 help / color / mirror / code / Atom feed
* Re: <> doesn't sort numerically
       [not found] <m2ivkoqsf4.fsf@diana.miranova.com>
@ 1995-11-14 10:06 ` Peter William Stephenson
  0 siblings, 0 replies; only message in thread
From: Peter William Stephenson @ 1995-11-14 10:06 UTC (permalink / raw)
  To: Steven L. Baur; +Cc: Zsh hackers list

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 <pws@ifh.de>       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.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1995-11-14 10:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <m2ivkoqsf4.fsf@diana.miranova.com>
1995-11-14 10:06 ` <> doesn't sort numerically Peter William Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).