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

Re: <> doesn't sort numerically



>>>>> "Peter" == P Stephenson <P.Stephenson@xxxxxxxxxxxxx> writes:

    Peter> steve@xxxxxxxxxxxx wrote:
    >> (zsh 2.6 beta 9).
    >> 
    >> I've noticed that <> doesn't appear to order the expanded files
    >> in numeric order.  Eg.  <> in a directory containing 1 2 4 9 24
    >> will expand as 1 2 24 4 9.  This isn't completely useful
    >> behavior.  The only workaround I've found is to use a
    >> succession of ? ?? ???, etc.

    Peter> You have to set the option `numericglobsort'.  This
    Peter> actually means you get the same result however the numbers
    Peter> are matched, with * or <> for example.  I think this was
    Peter> some unusual attempt at consistency.

O.K.  Thanks. The version of the manual I was looking at, made no
mention of this option in the globbing section.

    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 <>).

Thank you Thorsten (private mail), and Peter for responding.
-- 
steve@xxxxxxxxxxxx baur



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