From c3892613015af152fcaf38729f105a6370bbd63b Mon Sep 17 00:00:00 2001 From: Martin Berghaus Date: Sun, 23 Feb 2025 01:15:34 +0100 Subject: [PATCH] grep cleaned --- core/addToCrontabEveryHour.sh | 2 +- core/ensureUsageOfDefinitions.sh | 8 ++++---- prepareThisHostBeforeCloning.sh | 2 +- setupCoreOntoThisHost.sh | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/core/addToCrontabEveryHour.sh b/core/addToCrontabEveryHour.sh index cb6832a..3635750 100755 --- a/core/addToCrontabEveryHour.sh +++ b/core/addToCrontabEveryHour.sh @@ -21,7 +21,7 @@ function addToCrontabEveryHour() { && return 0 [ "$(id -u)" == "0" ] \ - && echo "${_CIS_ROOT:?"Missing CIS_ROOT"}" | grep "home" &> /dev/null \ + && echo "${_CIS_ROOT:?"Missing CIS_ROOT"}" | grep -F 'home' &> /dev/null \ && echo "SUCCESS: Although the entry will be skipped: ("$(readlink -f ${0})")" \ && echo " - '${_STRING}'" \ && echo " that is because the current environment is:" \ diff --git a/core/ensureUsageOfDefinitions.sh b/core/ensureUsageOfDefinitions.sh index 535c6ba..494a1d8 100755 --- a/core/ensureUsageOfDefinitions.sh +++ b/core/ensureUsageOfDefinitions.sh @@ -12,13 +12,13 @@ function printIfEqual() { } function isCoreDefinition() { - echo "${1:?"Missing first parameter FILE"}" | grep "/root/.ssh/authorized_keys" &> /dev/null \ + echo "${1:?"Missing first parameter FILE"}" | grep -F '/root/.ssh/authorized_keys' &> /dev/null \ && return 0 - echo "${1:?"Missing first parameter FILE"}" | grep "/home/jenkins/.ssh/authorized_keys" &> /dev/null \ + echo "${1:?"Missing first parameter FILE"}" | grep -F '/home/jenkins/.ssh/authorized_keys' &> /dev/null \ && return 0 - echo "${1:?"Missing first parameter FILE"}" | grep "/etc/sudoers.d/allow-jenkins-updateRepositories" &> /dev/null \ + echo "${1:?"Missing first parameter FILE"}" | grep -F '/etc/sudoers.d/allow-jenkins-updateRepositories' &> /dev/null \ && return 0 return 1 @@ -161,7 +161,7 @@ function ensureUsageOfDefinitions() { && echo " - '${_DEFINED_FULLFILE}'" \ && return 0 - echo "${_CIS_ROOT:?"Missing CIS_ROOT"}" | grep "home" &> /dev/null \ + echo "${_CIS_ROOT:?"Missing CIS_ROOT"}" | grep -F 'home' &> /dev/null \ && echo "SUCCESS: Although this definition will be skipped: ("$(readlink -f ${0})")" \ && echo " - '${_DEFINED_FULLFILE}'" \ && echo " that is because the current environment is:" \ diff --git a/prepareThisHostBeforeCloning.sh b/prepareThisHostBeforeCloning.sh index addeebf..f1ece09 100755 --- a/prepareThisHostBeforeCloning.sh +++ b/prepareThisHostBeforeCloning.sh @@ -8,7 +8,7 @@ function setNeededHostnameOrExit() { _FQDN="${1:?"Missing unique long hostname (fqdn, eg.: host1.example.net) for this host as first parameter."}" - echo "${_FQDN}" | grep '\.' &> /dev/null \ + echo "${_FQDN}" | grep -F '.' &> /dev/null \ && hostnamectl set-hostname "${_FQDN}" \ && return 0 diff --git a/setupCoreOntoThisHost.sh b/setupCoreOntoThisHost.sh index 562defa..aa3b92a 100755 --- a/setupCoreOntoThisHost.sh +++ b/setupCoreOntoThisHost.sh @@ -158,7 +158,7 @@ function addState() { function setupCoreFunctionality() { local _DEFINITIONS _MINUTE_FROM_OWN_IP _SETUP _DEFINITIONS="${1:?"Missing DEFINITIONS: 'ROOT/definitions/DOMAIN'"}" - _MINUTE_FROM_OWN_IP="$(hostname -I | xargs -n 1 | grep -F . | head -n 1 | cut -d. -f4 || echo 0)" #uses last value from first own ipv4 or 0 as minute value + _MINUTE_FROM_OWN_IP="$(hostname -I | xargs -n 1 | grep -F '.' | head -n 1 | cut -d. -f4 || echo 0)" #uses last value from first own ipv4 or 0 as minute value _SETUP="${2:?"Missing SETUP"}" readonly _DEFINITIONS _MINUTE_FROM_OWN_IP _SETUP