From c391723fe526f1426915d2a4b07e74e3c528c1e3 Mon Sep 17 00:00:00 2001 From: GoldenKiwi Date: Tue, 26 Dec 2023 17:08:53 +0100 Subject: [PATCH] fix: Allow --only option to be called multiple times (#225) --only option was affected with a grep bug since 2017. the regex was not able to parse more than the first passed argument. fixes #224 --- bin/hardening.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/hardening.sh b/bin/hardening.sh index 0ab2e78..7a8b9d4 100755 --- a/bin/hardening.sh +++ b/bin/hardening.sh @@ -299,7 +299,7 @@ for SCRIPT in $(find "${CIS_CHECKS_DIR}"/ -name "*.sh" | sort -V); do SCRIPT_PREFIX=$(grep -Eo '^[0-9.]+' <<<"$(basename "$SCRIPT")") # shellcheck disable=SC2001 SCRIPT_PREFIX_RE=$(sed -e 's/\./\\./g' <<<"$SCRIPT_PREFIX") - if ! grep -qwE "(^| )$SCRIPT_PREFIX_RE" <<<"${TEST_LIST[@]}"; then + if ! grep -qE "(^|[[:space:]])$SCRIPT_PREFIX_RE([[:space:]]|$)" <<<"${TEST_LIST[@]}"; then # not in the list continue fi