Use conditional expressions

For consistency, use conditional expressions instead of
arithmetic evaluation when comparing bash versions.
This commit is contained in:
Sam Doran 2025-03-11 23:24:28 -04:00
parent 13b0d850d8
commit 36eb43ebad
No known key found for this signature in database
GPG key ID: 01602635F94328AA

View file

@ -82,7 +82,7 @@ if ! enable -f "${BASH_SOURCE%/*}"/pyenv-realpath.dylib realpath 2>/dev/null; th
}
fi
if ((BASH_VERSINFO[0] > 3)); then
if [[ ${BASH_VERSINFO[0]} -gt 3 ]]; then
declare -A current_versions
else
current_versions=()
@ -94,7 +94,7 @@ else
miss_prefix=" "
OLDIFS="$IFS"
IFS=:
if ((BASH_VERSINFO[0] > 3)); then
if [[ ${BASH_VERSINFO[0]} -gt 3 ]]; then
for i in $(pyenv-version-name || true); do
current_versions["$i"]="1"
done
@ -135,7 +135,7 @@ print_version() {
fi
if [[ ${BASH_VERSINFO[0]} -ge 4 && ${current_versions["$1"]} ]]; then
echo "${hit_prefix}${version_repr} (set by $(pyenv-version-origin))"
elif (( BASH_VERSINFO[0] <= 3 )) && exists "$1" "${current_versions[@]}"; then
elif [[ ${BASH_VERSINFO[0]} -le 3 ]] && exists "$1" "${current_versions[@]}"; then
echo "${hit_prefix}${version_repr} (set by $(pyenv-version-origin))"
else
echo "${miss_prefix}${version_repr}"