summaryrefslogtreecommitdiff
path: root/Functions/Misc/is-at-least
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2000-08-10 16:53:00 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2000-08-10 16:53:00 +0000
commit432c0af097470b5276ebd1cce325a662697a3a24 (patch)
tree5770ead173027f68694bcf83fea4ac11cc47f1be /Functions/Misc/is-at-least
parentf6ecbb7f4d74099a0d4b342996696159344f4235 (diff)
downloadzsh-432c0af097470b5276ebd1cce325a662697a3a24.tar.gz
zsh-432c0af097470b5276ebd1cce325a662697a3a24.zip
12582: improved first argument for is-at-least
Diffstat (limited to 'Functions/Misc/is-at-least')
-rw-r--r--Functions/Misc/is-at-least16
1 files changed, 10 insertions, 6 deletions
diff --git a/Functions/Misc/is-at-least b/Functions/Misc/is-at-least
index eab771332..4c12f9c2c 100644
--- a/Functions/Misc/is-at-least
+++ b/Functions/Misc/is-at-least
@@ -12,6 +12,7 @@
# is-at-least 3.1.6-15 && setopt NO_GLOBAL_RCS
# is-at-least 3.1.0 && setopt HIST_REDUCE_BLANKS
# is-at-least 586 $MACHTYPE && echo 'You could be running Mandrake!'
+# is-at-least $ZSH_VERSION || print 'Something fishy here.'
function is-at-least()
{
@@ -19,14 +20,17 @@ function is-at-least()
local IFS=".-" min_cnt=0 ver_cnt=0 part min_ver version
min_ver=(${=1})
version=(${=2:-$ZSH_VERSION} 0)
- while (( $min_cnt <= ${#min_ver} )) {
- while [[ "$part" != <-> ]] {
- [[ $[++ver_cnt] > ${#version} ]] && return 0
+ while (( $min_cnt <= ${#min_ver} )); do
+ while [[ "$part" != <-> ]]; do
+ (( ++ver_cnt > ${#version} )) && return 0
part=${version[ver_cnt]##*[^0-9]}
- }
- [[ $[++min_cnt] > ${#min_ver} ]] && return 0
+ done
+ while true; do
+ (( ++min_cnt > ${#min_ver} )) && return 0
+ [[ ${min_ver[min_cnt]} = <-> ]] && break
+ done
(( part > min_ver[min_cnt] )) && return 0
(( part < min_ver[min_cnt] )) && return 1
part=''
- }
+ done
}