diff --git a/cd.sh b/cd.sh index a9abcce..2235040 100644 --- a/cd.sh +++ b/cd.sh @@ -47,7 +47,13 @@ cd_set_environment_variables () { case "$(cd_grep_os ID)" in "almalinux") CD_OS_ID="${CD_OS_ALMA}" - CD_OS_VERSION="$(cd_grep_os VERSION_ID)" + CD_OS_VERSION=$(cd_grep_os VERSION_ID \ + | sed "s|^\([0-9]\+\)\..*|\1|" ) + ;; + "alpine") + CD_OS_ID="${CD_OS_ALPINE}" + CD_OS_VERSION=$(cd_grep_os VERSION_ID \ + | sed "s|^\([0-9]\+\.[0-9]\+\)\..*|\1|" ) ;; "debian") CD_OS_ID="${CD_OS_DEBIAN}" @@ -402,8 +408,7 @@ local variable="${1}" if [ "${variable}" ] ; then grep "^${variable}=" "/etc/os-release" \ | sed "s|^${variable}=||" \ - | sed "s|^\"\(.*\)\"$|\1|" \ - | sed "s|^\([0-9]\+\)\..*|\1|" + | sed "s|^\"\(.*\)\"$|\1|" fi }