From 4fc79c133f252141fd8f8446ee1b0169586b0095 Mon Sep 17 00:00:00 2001 From: Charles Herlin Date: Thu, 15 Mar 2018 12:03:10 +0100 Subject: [PATCH] Improve --only option to perform only specified test and no other lookalike test number Before modification "--only 8.2.1" performed tests 8.2.1 and 2.1 --- bin/hardening.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/hardening.sh b/bin/hardening.sh index 914d964..d7e22f9 100755 --- a/bin/hardening.sh +++ b/bin/hardening.sh @@ -199,7 +199,7 @@ for SCRIPT in $(ls $CIS_ROOT_DIR/bin/hardening/*.sh -v); do # --only X has been specified at least once, is this script in my list ? SCRIPT_PREFIX=$(grep -Eo '^[0-9.]+' <<< "$(basename $SCRIPT)") SCRIPT_PREFIX_RE=$(sed -e 's/\./\\./g' <<< "$SCRIPT_PREFIX") - if ! grep -qEw "$SCRIPT_PREFIX_RE" <<< "${TEST_LIST[@]}"; then + if ! grep -qE "(^| )$SCRIPT_PREFIX_RE" <<< "${TEST_LIST[@]}"; then # not in the list continue fi