更新工具箱versioncmp,尝试使用gitee源

This commit is contained in:
monlor
2020-03-05 15:41:07 +08:00
parent 9244a96773
commit 0bb0ad279b
9 changed files with 31 additions and 12 deletions

View File

@@ -58,4 +58,20 @@ base_decode() {
echo -n "$*" | baseutil --b64 -d
fi
fi
}
}
# $1 > $2 => -1
# $1 < $2 => 1
# $1 = $2 => 0
versioncmp() {
[ "$1" = "$2" ] && echo -n "0" && return
if test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" != "$1"; then
echo -n "-1"
else
echo -n "1"
fi
}