【发布时间】:2022-06-14 16:55:57
【问题描述】:
我正在尝试使用我自己的 bash 脚本来参考 https://github.com/Frugghi/iSSH2 来为苹果平台生成 libssl 和 libssh 库。我想尝试自己的 bash 脚本的原因是获取最近的库并保持更新。
我有两个 bash 脚本来检测最新版本的 openssl 和 libssh2 库:
getLibssh2Version () {
if type git >/dev/null 2>&1; then
LIBSSH_VERSION=`git ls-remote --tags https://github.com/libssh2/libssh2.git | egrep "libssh2-[0-9]+(\.[0-9])*[a-zA-Z]?$" | cut -f 2 -d - | sort -t . -r | head -n 1`
LIBSSH_AUTO=true
}
和
getOpensslVersion () {
if type git >/dev/null 2>&1; then
LIBSSL_VERSION=`git ls-remote --tags git://git.openssl.org/openssl.git | egrep "OpenSSL(_[0-9])+[a-zA-Z]?$" | cut -f 2,3,4 -d _ | sort -t _ -r | head -n 1 | tr _ .`
LIBSSL_AUTO=true
}
但是第一个脚本获取的是 1.9.0 版本的 Libssh2 而不是 1.10.0,第二个脚本获取的是 1.1.1n 系列的 OpenSSL 而不是 3.0.2。我想这与定义的正则表达式有关。有人能解决这个脚本错误吗?
【问题讨论】:
标签: grep