From 0c48fc3880551d862063e56a029ce43082df376a Mon Sep 17 00:00:00 2001 From: SiemKorteweg Date: Sat, 10 Oct 2015 13:25:14 +0200 Subject: Optimized use of cat, grep and awk. Detection of duplicate entries in /etc/hosts is now more robust. On CentOS7 the SERVICE_MANAGER is detected correctly. --- extras/build-lynis.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'extras') diff --git a/extras/build-lynis.sh b/extras/build-lynis.sh index f0f6cc72..b4f4402e 100755 --- a/extras/build-lynis.sh +++ b/extras/build-lynis.sh @@ -212,7 +212,7 @@ if [ -f ${SOURCEFILE_RPM} ]; then if [ -f lynis.spec ]; then # adjust version in spec file - VERSION_IN_SPECFILE=`cat lynis.spec | grep "^Version:" | sed 's/ //g' | awk -F: '{ print $2 }'` + VERSION_IN_SPECFILE=`awk '/^Version:/ { print $2 }' lynis.spec` echo "[=] Found version ${VERSION_IN_SPECFILE}" if [ ${VERSION_IN_SPECFILE} = "" -o ! "${VERSION_IN_SPECFILE}" = "${LYNIS_VERSION}" ]; then echo "[X] Version in specfile is outdated" @@ -372,12 +372,12 @@ Exit #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= echo -n "- Creating MD5 hashes..." - PACKAGE_LIST_FILES=`cat files.dat | grep "^file:" | cut -d ':' -f3` + PACKAGE_LIST_FILES=`grep "^file:" files.dat | cut -d ':' -f3` for I in ${PACKAGE_LIST_FILES}; do echo -n "${I} " - #FULLNAME=`cat files.dat | grep ":file:include: + #FULLNAME=`grep ":file:include:" files.dat #echo "${FULLNAME}" >> ${OPENBSD_CONTENTS} echo "${I}" >> ${OPENBSD_CONTENTS} FILE="../${I}" -- cgit v1.2.3