From 2ed84e4b1eec95c30a57850aff731183e98d149e Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Wed, 15 Apr 2026 21:24:40 +0900 Subject: [PATCH] Reduce sed usage --- main.sh | 3 ++- tools/ci/tool-list.sh | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/main.sh b/main.sh index ce3ebb72..f00ba5f4 100755 --- a/main.sh +++ b/main.sh @@ -464,7 +464,8 @@ case "$(uname -s)" in host_env=musl else host_env=gnu - host_glibc_version=$(grep -E "GLIBC|GNU libc" <<<"${ldd_version}" | sed -E "s/.* //g") + host_glibc_version=$(grep -E "GLIBC|GNU libc" <<<"${ldd_version}") + host_glibc_version="${host_glibc_version##* }" fi if [[ -e /etc/redhat-release ]]; then # /etc/os-release is available on RHEL/CentOS 7+ diff --git a/tools/ci/tool-list.sh b/tools/ci/tool-list.sh index 449ca083..941d5762 100755 --- a/tools/ci/tool-list.sh +++ b/tools/ci/tool-list.sh @@ -72,7 +72,8 @@ case "$(uname -s)" in if [[ "${ldd_version}" == *'musl'* ]]; then incompat_tools+=("${musl_incompat[@]}") else - host_glibc_version=$(grep -E "GLIBC|GNU libc" <<<"${ldd_version}" | sed "s/.* //g") + host_glibc_version=$(grep -E "GLIBC|GNU libc" <<<"${ldd_version}") + host_glibc_version="${host_glibc_version##* }" higher_glibc_version=$(LC_ALL=C sort -Vu <<<"2.39"$'\n'"${host_glibc_version}" | tail -1) if [[ "${higher_glibc_version}" != "${host_glibc_version}" ]]; then higher_glibc_version=$(LC_ALL=C sort -Vu <<<"2.35"$'\n'"${host_glibc_version}" | tail -1)