From 2d207d52e1d26bc952118b07412d66d0ea1b93d0 Mon Sep 17 00:00:00 2001 From: 233boy <31657650+233boy@users.noreply.github.com> Date: Fri, 8 Mar 2019 14:53:55 +0800 Subject: [PATCH] update kernel version check --- src/bbr.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/bbr.sh b/src/bbr.sh index 37d6c38..f81654b 100644 --- a/src/bbr.sh +++ b/src/bbr.sh @@ -6,10 +6,12 @@ _open_bbr() { sysctl -p >/dev/null 2>&1 } -if [[ $(uname -r | cut -b 1) -eq 4 ]]; then - case $(uname -r | cut -b 3-4) in - 9. | [1-9][0-9]) +_kernel_ver() { + local _test1=$(uname -r | cut -d\. -f1) + local _test2=$(uname -r | cut -d\. -f2) + if [[ $_test1 -eq 4 && $_test2 -ge 9 ]] || [[ $_test1 -ge 5 ]]; then _open_bbr - ;; - esac -fi + fi +} + +_kernel_ver