From 3abf55f7217cbbfcae549d5ab7603c72de90a4a6 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 3 May 2024 12:42:35 +0200 Subject: [PATCH] cd_grep_os --- cd.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cd.sh b/cd.sh index 3161651..29060d7 100644 --- a/cd.sh +++ b/cd.sh @@ -324,8 +324,13 @@ local variable="${1}" exit 2 } -cd_get_string () { - [ "${1}" ] && echo "${1}" | cut -d "=" -f 2 | cut -d "\"" -f 2 +cd_grep_os () { +local variable="${1}" + if [ "${variable}" ] ; then + grep "^${variable}=" "/etc/os-release" \ + | sed "s|^${variable}||" \ + | sed "s|^\"\(.*\)\"$|\1|" + fi } cd_install_package () {