From 05053a9ffaf33cae81b1ebf02aef1e97d0bbb586 Mon Sep 17 00:00:00 2001 From: "Hahn Axel (hahn)" <axel.hahn@iml.unibe.ch> Date: Thu, 16 Dec 2021 16:10:38 +0100 Subject: [PATCH] packages2install: add missing function _filterPkg --- check_packages2install | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/check_packages2install b/check_packages2install index 505bf04..8c8981b 100755 --- a/check_packages2install +++ b/check_packages2install @@ -56,7 +56,18 @@ function _exec(){ fi } +# apply filter on incoming piped data +# filter is a param with spaced keywords that will be transformed +# to a regex +# param1 text if filter keywords (seperated by space) +function _filterPkg(){ + local _filter=$( echo $1 | tr " " "|" ) + + grep -E "^($_filter)" +} +# autodetect a package manager using which with +# a list of known pkg managers function detectPkgManager(){ local _list="apt yum pamac" local out=$( _exec "which $_list 2>/dev/null" ) -- GitLab