* <x-y> globing pattern doesn't sort?
@ 2004-09-13 15:29 Louis-David Mitterrand
2004-09-13 16:00 ` Oliver Kiddle
2004-09-13 16:10 ` Peter Stephenson
0 siblings, 2 replies; 5+ messages in thread
From: Louis-David Mitterrand @ 2004-09-13 15:29 UTC (permalink / raw)
To: zsh-users
Hello,
I just tried that:
% bzcat ../patch-2.6.9-rc1.bz2 ../patch-2.6.9-rc1-bk<1-19>.bz2<TAB>
and obtained:
bzcat ../patch-2.6.9-rc1.bz2 ../patch-2.6.9-rc1-bk10.bz2 ../patch-2.6.9-rc1-bk11.bz2 ../patch-2.6.9-rc1-bk12.bz2 ../patch-2.6.9-rc1-bk13.bz2 ../patch-2.6.9-rc1-bk14.bz2 ../patch-2.6.9-rc1-bk15.bz2 ../patch-2.6.9-rc1-bk16.bz2 ../patch-2.6.9-rc1-bk17.bz2 ../patch-2.6.9-rc1-bk18.bz2 ../patch-2.6.9-rc1-bk19.bz2 ../patch-2.6.9-rc1-bk1.bz2 ../patch-2.6.9-rc1-bk2.bz2 ../patch-2.6.9-rc1-bk3.bz2 ../patch-2.6.9-rc1-bk4.bz2 ../patch-2.6.9-rc1-bk5.bz2 ../patch-2.6.9-rc1-bk6.bz2 ../patch-2.6.9-rc1-bk7.bz2 ../patch-2.6.9-rc1-bk8.bz2 ../patch-2.6.9-rc1-bk9.bz2
which really suprised my as I thought the whole point of the <-> pattern
was to allow for an ordered sequence to be returned (contrary to a
simple *).
Am I mistaken in that belief?
--
What influenced me to atheism was reading the Bible cover to cover.
Twice. -- J. Michael Straczynski
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: <x-y> globing pattern doesn't sort?
2004-09-13 15:29 <x-y> globing pattern doesn't sort? Louis-David Mitterrand
@ 2004-09-13 16:00 ` Oliver Kiddle
2004-09-14 7:20 ` Louis-David Mitterrand
2004-09-13 16:10 ` Peter Stephenson
1 sibling, 1 reply; 5+ messages in thread
From: Oliver Kiddle @ 2004-09-13 16:00 UTC (permalink / raw)
To: Louis-David Mitterrand; +Cc: zsh-users
Louis-David Mitterrand wrote:
> I just tried that:
>
> % bzcat ../patch-2.6.9-rc1.bz2 ../patch-2.6.9-rc1-bk<1-19>.bz2<TAB>
>
> and obtained:
>
> bzcat ../patch-2.6.9-rc1.bz2 ../patch-2.6.9-rc1-bk10.bz2 ../patch-2.6.9-rc1-bk11.bz2 ../patch-2.6.9-rc1-bk12.bz2 ../patch-2.6.9-rc1-bk13.bz2 ../patch-2.6.9-rc1-bk14.bz2 ../patch-2.6.9-rc1-bk15.bz2 ../patch-2.6.9-rc1-bk16.bz2 ../patch-2.6.9-rc1-bk17.bz2 ../patch-2.6.9-rc1-bk18.bz2 ../patch-2.6.9-rc1-bk19.bz2 ../patch-2.6.9-rc1-bk1.bz2 ../patch-2.6.9-rc1-bk2.bz2 ../patch-2.6.9-rc1-bk3.bz2 ../patch-2.6.9-rc1-bk4.bz2 ../patch-2.6.9-rc1-bk5.bz2 ../patch-2.6.9-rc1-bk6.bz2 ../patch-2.6.9-rc1-bk7.bz2 ../patch-2.6.9-rc1-bk8.bz2 ../patch-2.6.9-rc1-bk9.bz2
Is it the order of the expansions that surprised you. It often helps us
understand a point like this if you state what you expected to obtain.
> which really suprised my as I thought the whole point of the <-> pattern
> was to allow for an ordered sequence to be returned (contrary to a
> simple *).
>
> Am I mistaken in that belief?
<-> doesn't expand a sequence in order. Like *, it is just matching
filenames except it looks for a number within a range. Files are matched
and then sorted.
You could use {1..19} for an ordered expansion but that expands
unconditionally: there doesn't need to be existing files with each name
in the sequence.
Alternatively, you can use the (n) glob qualifier to sort the
expansions numerically:
patch*(n)
Oliver
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: <x-y> globing pattern doesn't sort?
2004-09-13 16:00 ` Oliver Kiddle
@ 2004-09-14 7:20 ` Louis-David Mitterrand
0 siblings, 0 replies; 5+ messages in thread
From: Louis-David Mitterrand @ 2004-09-14 7:20 UTC (permalink / raw)
To: zsh-users
On Mon, Sep 13, 2004 at 06:00:36PM +0200, Oliver Kiddle wrote:
> Louis-David Mitterrand wrote:
> > I just tried that:
> >
> > % bzcat ../patch-2.6.9-rc1.bz2 ../patch-2.6.9-rc1-bk<1-19>.bz2<TAB>
> >
> > and obtained:
> >
> > bzcat ../patch-2.6.9-rc1.bz2 ../patch-2.6.9-rc1-bk10.bz2 ../patch-2.6.9-rc1-bk11.bz2 ../patch-2.6.9-rc1-bk12.bz2 ../patch-2.6.9-rc1-bk13.bz2 ../patch-2.6.9-rc1-bk14.bz2 ../patch-2.6.9-rc1-bk15.bz2 ../patch-2.6.9-rc1-bk16.bz2 ../patch-2.6.9-rc1-bk17.bz2 ../patch-2.6.9-rc1-bk18.bz2 ../patch-2.6.9-rc1-bk19.bz2 ../patch-2.6.9-rc1-bk1.bz2 ../patch-2.6.9-rc1-bk2.bz2 ../patch-2.6.9-rc1-bk3.bz2 ../patch-2.6.9-rc1-bk4.bz2 ../patch-2.6.9-rc1-bk5.bz2 ../patch-2.6.9-rc1-bk6.bz2 ../patch-2.6.9-rc1-bk7.bz2 ../patch-2.6.9-rc1-bk8.bz2 ../patch-2.6.9-rc1-bk9.bz2
>
> Is it the order of the expansions that surprised you. It often helps us
> understand a point like this if you state what you expected to obtain.
Right, I expected the list to be numerically sorted. Actually I now
understand <-> is a way to state a range and has nothing to do with
sorting.
> > which really suprised my as I thought the whole point of the <-> pattern
> > was to allow for an ordered sequence to be returned (contrary to a
> > simple *).
> >
> > Am I mistaken in that belief?
>
> <-> doesn't expand a sequence in order. Like *, it is just matching
> filenames except it looks for a number within a range. Files are matched
> and then sorted.
>
> You could use {1..19} for an ordered expansion but that expands
> unconditionally: there doesn't need to be existing files with each name
> in the sequence.
>
> Alternatively, you can use the (n) glob qualifier to sort the
> expansions numerically:
> patch*(n)
Hey, thanks for these snippets. I learned two new tricks today.
Best regards,
--
Hi, I am an alien .sig, and at the moment I am having sex to your
mind, by looking at your smile I can see that you like it.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: <x-y> globing pattern doesn't sort?
2004-09-13 15:29 <x-y> globing pattern doesn't sort? Louis-David Mitterrand
2004-09-13 16:00 ` Oliver Kiddle
@ 2004-09-13 16:10 ` Peter Stephenson
2004-09-14 7:26 ` Louis-David Mitterrand
1 sibling, 1 reply; 5+ messages in thread
From: Peter Stephenson @ 2004-09-13 16:10 UTC (permalink / raw)
To: zsh-users
Louis-David Mitterrand wrote:
> Hello,
>
> I just tried that:
>
> % bzcat ../patch-2.6.9-rc1.bz2 ../patch-2.6.9-rc1-bk<1-19>.bz2<TAB>
>
> and obtained:
>
> bzcat ../patch-2.6.9-rc1.bz2 ../patch-2.6.9-rc1-bk10.bz2 ../patch-2.6.9-rc1-b
> k11.bz2 ../patch-2.6.9-rc1-bk12.bz2 ../patch-2.6.9-rc1-bk13.bz2 ../patch-2.6.
> 9-rc1-bk14.bz2 ../patch-2.6.9-rc1-bk15.bz2 ../patch-2.6.9-rc1-bk16.bz2 ../pat
> ch-2.6.9-rc1-bk17.bz2 ../patch-2.6.9-rc1-bk18.bz2 ../patch-2.6.9-rc1-bk19.bz2
> ../patch-2.6.9-rc1-bk1.bz2 ../patch-2.6.9-rc1-bk2.bz2 ../patch-2.6.9-rc1-bk3
> .bz2 ../patch-2.6.9-rc1-bk4.bz2 ../patch-2.6.9-rc1-bk5.bz2 ../patch-2.6.9-rc1
> -bk6.bz2 ../patch-2.6.9-rc1-bk7.bz2 ../patch-2.6.9-rc1-bk8.bz2 ../patch-2.6.9
> -rc1-bk9.bz2
>
> which really suprised my as I thought the whole point of the <-> pattern
> was to allow for an ordered sequence to be returned (contrary to a
> simple *).
>
> Am I mistaken in that belief?
Yes. However, you can set the option numeric_glob_sort. A quick test
suggests completion will obey this, which does what you want. Note that
that's independent of how the matches were generated, however, so
replacing <1-19> with * wouldn't change the result.
--
Peter Stephenson <pws@csr.com> Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK Tel: +44 (0)1223 692070
**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential
and/or privileged material.
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by
persons or entities other than the intended recipient is
prohibited.
If you received this in error, please contact the sender and
delete the material from any computer.
**********************************************************************
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: <x-y> globing pattern doesn't sort?
2004-09-13 16:10 ` Peter Stephenson
@ 2004-09-14 7:26 ` Louis-David Mitterrand
0 siblings, 0 replies; 5+ messages in thread
From: Louis-David Mitterrand @ 2004-09-14 7:26 UTC (permalink / raw)
To: zsh-users
On Mon, Sep 13, 2004 at 05:10:07PM +0100, Peter Stephenson wrote:
> > which really suprised my as I thought the whole point of the <-> pattern
> > was to allow for an ordered sequence to be returned (contrary to a
> > simple *).
> >
> > Am I mistaken in that belief?
>
> Yes. However, you can set the option numeric_glob_sort. A quick test
> suggests completion will obey this, which does what you want. Note that
> that's independent of how the matches were generated, however, so
> replacing <1-19> with * wouldn't change the result.
Thanks for the explanation. As always: I had a dream, zsh had it
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-09-14 7:27 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-13 15:29 <x-y> globing pattern doesn't sort? Louis-David Mitterrand
2004-09-13 16:00 ` Oliver Kiddle
2004-09-14 7:20 ` Louis-David Mitterrand
2004-09-13 16:10 ` Peter Stephenson
2004-09-14 7:26 ` Louis-David Mitterrand
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).