Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Numeric version of ZSH_VERSION?
- X-seq: zsh-workers 25563
- From: Dan Nelson <dnelson@xxxxxxxxxxxxxxx>
- To: Rocky Bernstein <rocky.bernstein@xxxxxxxxx>
- Subject: Re: Numeric version of ZSH_VERSION?
- Date: Sat, 30 Aug 2008 22:16:32 -0500
- Cc: Zsh hackers list <zsh-workers@xxxxxxxxxx>
- In-reply-to: <6cd6de210808301954x6fd72987i4bb0ea3665951de1@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <6cd6de210808301954x6fd72987i4bb0ea3665951de1@xxxxxxxxxxxxxx>
In the last episode (Aug 30), Rocky Bernstein said:
> It'd be nice to have a numeric version of ZSH_VERSION which is just a
> monotonically increasing number. It would make testing for features in
> (possibly open-ended) ranges easy.
The Misc/is-at-least function should do what you need:
OTHER FUNCTIONS
Descriptions
is-at-least needed [ present ]
Perform a greater-than-or-equal-to comparison of two strings
having the format of a zsh version number; that is, a string of
numbers and text with segments separated by dots or dashes. If
the present string is not provided, $ZSH_VERSION is used. Seg-
ments are paired left-to-right in the two strings with leading
non-number parts ignored. If one string has fewer segments than
the other, the missing segments are considered zero.
This is useful in startup files to set options and other state
that are not available in all versions of zsh.
is-at-least 3.1.6-15 && setopt NO_GLOBAL_RCS
is-at-least 3.1.0 && setopt HIST_REDUCE_BLANKS
is-at-least 2.6-17 || print "You can't use is-at-least here."
--
Dan Nelson
dnelson@xxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author