diff options
| author | Stephane Chazelas <stephane@chazelas.org> | 2023-06-22 12:52:12 -0700 |
|---|---|---|
| committer | Bart Schaefer <schaefer@zsh.org> | 2023-06-22 12:52:12 -0700 |
| commit | 4f6a1b3717bb84b8243b13c4ec9171945893c934 (patch) | |
| tree | 68aec178a07a90dfb8d572f185b51b8e80aca3bb /Functions | |
| parent | 51877: do not build pcre module if pcre2-config is not found (diff) | |
| download | zsh-4f6a1b3717bb84b8243b13c4ec9171945893c934.tar zsh-4f6a1b3717bb84b8243b13c4ec9171945893c934.tar.gz zsh-4f6a1b3717bb84b8243b13c4ec9171945893c934.tar.bz2 zsh-4f6a1b3717bb84b8243b13c4ec9171945893c934.tar.lz zsh-4f6a1b3717bb84b8243b13c4ec9171945893c934.tar.xz zsh-4f6a1b3717bb84b8243b13c4ec9171945893c934.tar.zst zsh-4f6a1b3717bb84b8243b13c4ec9171945893c934.zip | |
51813: differentiate empty $2 from omitted $2 in version comparisons
Diffstat (limited to 'Functions')
| -rw-r--r-- | Functions/Misc/is-at-least | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Functions/Misc/is-at-least b/Functions/Misc/is-at-least index d4ff3552a..5985684be 100644 --- a/Functions/Misc/is-at-least +++ b/Functions/Misc/is-at-least @@ -24,8 +24,14 @@ emulate -L zsh local IFS=".-" min_cnt=0 ver_cnt=0 part min_ver version order +: ${2=$ZSH_VERSION} + +# sort out the easy corner cases first +[[ $1 = $2 ]] && return 0 # same version +[[ -n $2 ]] || return 1 # no version + min_ver=(${=1}) -version=(${=2:-$ZSH_VERSION} 0) +version=(${=2} 0) while (( $min_cnt <= ${#min_ver} )); do while [[ "$part" != <-> ]]; do |
