Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: How do I find shortest match?
- X-seq: zsh-users 17091
- From: TJ Luoma <luomat@xxxxxxxxx>
- To: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- Subject: Re: How do I find shortest match?
- Date: Thu, 17 May 2012 15:11:09 -0400
- Cc: Zsh-Users List <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:message-id:in-reply-to:references:subject:x-mailer :mime-version:content-type:content-transfer-encoding :content-disposition; bh=fdZFes/nZP1iC+76/RFVBHF7yePXnqA5Q8o4WFWUu9Y=; b=lP3G1epOSDAKPL9A2GQJvIe++AiaMCsLxnVIbBqhoAz0aL3YNpfjAW1gkC+JjlcbPL tXqVEgZGRpSQ9W2rrVnb7uD2XaaHDnCnYwXzMrk/h1hAPt7RJsOnmS5RNljYZjEKJWZM 5cdG5OJiKRlofp3PaB47+ySgA2Wo+LF4SwJN6gE5Vcp3oT8NxlQukJZQuJWCmZy1cUgv vRor1jnForHNi9R+dKKJh9eN/mDbhU3JLfEsdL3puWPbDzdyNYTtleQr/6xHzEagcEKi AkuGpBvv8PI9IQxUz3EX9+3Y1IxeTillPMLVHANawr2d5F7bGDGcQp9NayAkxu98Hj/g lSCw==
- In-reply-to: <20120517200503.7017ac87@pws-pc.ntlworld.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <r422Ps-1074i-D2378FC62AA34C38A65805B0D3A80DBF@Air> <20120517200503.7017ac87@pws-pc.ntlworld.com>
On Thursday, May 17, 2012 at 3:05 PM, Peter Stephenson wrote:
> There's a really nasty trick that doesn't require them to correspond to files, which you'll hate. I think you can combine it into a single expression, but it's bad enough in two.
>
> local min
> min=(${${(o)${MATCHES//?/\?}}[1]})
> print -l ${MATCHES:#^${~min}}
>
> I'm sure it's completely obvious what this is doing. It's been posted before.
I have the memory and attention span of a tsetse fly, so I'll take your word for it, although I myself have no idea what this is doing. I've long accepted the fact that zsh is smarter than I am, and only hope to make the best use of it whenever possible :-)
TjL
ps - Thanks for the reply and solutions.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author