Zsh Mailing List Archive
Messages sorted by:
Re: possible 'is-at-least' bug?
- X-seq: zsh-users 21047
- From: "Benjamin R. Haskell" <zsh@xxxxxxxxxx>
- To: TJ Luoma <luomat@xxxxxxxxx>
- Subject: Re: possible 'is-at-least' bug?
- Date: Sat, 5 Dec 2015 01:29:46 -0500
- Cc: Zsh-Users List <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=benizi-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=xjtGUFVqKmBsLBTdEajmznPE+GbrkxuNMuVMkj/gyoA=; b=LZR3JHEaJ4T6X9TYi4GxJrVHcEVfPeidOBe5DUA+pnT3scJf7/jQ4v1qle1fUaETpk 9tuBOl6R2eJlm0vTb5n4R/FmVCsREexzNyh7d5e97DT0gCou4xVqXScomMDGJQi+Xm7/ nYE1DqfBzYI21AMd44QlJMnLmigKZr91tk+Zf1NWxqan/EZenV9GqxhUhrZ7BLexPmr/ WsMF1KpKb2jpXwrZ5FBLp4XoezVBHzXgW9XbcvUMcqGxoXEv+4NmcigYvIjmSdSqlQZJ bRw2adlJfR3R2MHKVsjiMAVdPEm1YJGBzZjOXhYIJ0lGjlFmjxJ+989iQzGC8Dbghhbm 4miA==
- In-reply-to: <CADjGqHue=fEzyoayraCEZtqzuExyJiGuMjUDHKYtEOu47w6bew@mail.gmail.com>
- List-help: <mailto:email@example.com>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:firstname.lastname@example.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CADjGqHue=fEzyoayraCEZtqzuExyJiGuMjUDHKYtEOu47w6bew@mail.gmail.com>
- Sender: benizi@xxxxxxxxxx
On Fri, Dec 4, 2015 at 6:45 PM, TJ Luoma <luomat@xxxxxxxxx> wrote:
> Thanks to a recent tip from the list, I've started using 'is-at-least' to
> compare version numbers.
> However, I seem to have found a situation/edge case where it does not seem
> to work.
> I am trying to compare version numbers of software, in this case ImageOptim
> for the Mac.
`is-at-least` isn't intended to be that general. From `man zshall`:
is-at-least needed [ present ]
Perform a greater-than-or-equal-to comparison of two strings having
format of a zsh version number; that is, a string of numbers and text
segments separated by dots or dashes.
To do so would require a great deal more complexity. It'd probably be a
better check for a package manager (where the version strings can be
limited to a specific format).
The version I have installed is '1.6.1a1' where the 'a' is for 'alpha'
> There is a newer version '1.6.1b2' where the 'b' is for 'beta'
> autoload is-at-least
> is-at-least "$LATEST_VERSION" "$INSTALLED_VERSION"
For this specific case, the following seems reasonable:
'(#b)' in a pattern activates back references
'##' is the equivalent of '+' in most regular expression libraries
I think both of those require 'EXTENDED_GLOB'
The `~` in $~alpha means treat the contents of $alpha as a pattern, not
just a string to match
The $match is the parenthesized group in the match (so, a string of
Messages sorted by: