zsh-users
 help / color / mirror / code / Atom feed
From: Louis-David Mitterrand <vindex@apartia.org>
To: zsh-users@sunsite.dk
Subject: Re: <x-y> globing pattern doesn't sort?
Date: Tue, 14 Sep 2004 09:20:55 +0200	[thread overview]
Message-ID: <20040914072054.GA15962@apartia.fr> (raw)
In-Reply-To: <6353.1095091236@trentino.logica.co.uk>

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.


  reply	other threads:[~2004-09-14  7:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-13 15:29 Louis-David Mitterrand
2004-09-13 16:00 ` Oliver Kiddle
2004-09-14  7:20   ` Louis-David Mitterrand [this message]
2004-09-13 16:10 ` Peter Stephenson
2004-09-14  7:26   ` Louis-David Mitterrand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040914072054.GA15962@apartia.fr \
    --to=vindex@apartia.org \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).