From afa289d9b7bcf9666f4a22d3e5b427f0d862d169 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Sj=C3=B6gren?= Date: Wed, 24 Oct 2018 10:01:27 +0200 Subject: [PATCH] sed option extravaganza #330 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Thomas Sjögren --- docker-bench-security.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-bench-security.sh b/docker-bench-security.sh index a1c21a8..6a5b18f 100755 --- a/docker-bench-security.sh +++ b/docker-bench-security.sh @@ -123,8 +123,8 @@ main () { if [ -z "$check" ] && [ ! "$checkexclude" ]; then cis elif [ -z "$check" ] && [ "$checkexclude" ]; then - checkexcluded="$(echo "$checkexclude" | sed 's/,/|/g')" - for c in $(grep 'check_[0-9]_' functions_lib.sh | grep -vE "$checkexcluded"); do + checkexcluded="$(echo ",$checkexclude" | sed -e 's/^/\^/g' -e 's/,/\$|/g' -e 's/$/\$/g')" + for c in $(grep 'check_[0-9]_' functions_lib.sh | grep -vE "\'$checkexcluded\'"); do "$c" done else