mirror of
https://github.com/CISOfy/lynis.git
synced 2025-07-28 00:04:16 +02:00
[NAME-4402] Enhanced test to filter out empty lines
This commit is contained in:
parent
dabf7d3e80
commit
a7845b6748
@ -573,12 +573,12 @@
|
|||||||
if [ ${SKIPTEST} -eq 0 ]; then
|
if [ ${SKIPTEST} -eq 0 ]; then
|
||||||
LogText "Test: check duplicate line in ${ROOTDIR}etc/hosts"
|
LogText "Test: check duplicate line in ${ROOTDIR}etc/hosts"
|
||||||
if [ -f ${ROOTDIR}etc/hosts ]; then
|
if [ -f ${ROOTDIR}etc/hosts ]; then
|
||||||
sFIND=$(${EGREPBINARY} -v '^(#|$)' ${ROOTDIR}etc/hosts | ${AWKBINARY} '{ print $1, $2 }' | ${SORTBINARY} | ${UNIQBINARY} -d)
|
OUTPUT=$(${AWKBINARY} '{ print $1, $2 }' ${ROOTDIR}etc/hosts | ${EGREPBINARY} -v '^(#|$)' | ${EGREPBINARY} "[a-f0-9]" | ${SORTBINARY} | ${UNIQBINARY} -d)
|
||||||
if [ "${sFIND}" = "" ]; then
|
if [ -z "${OUTPUT}" ]; then
|
||||||
LogText "Result: OK, no duplicate lines found"
|
LogText "Result: OK, no duplicate lines found"
|
||||||
Display --indent 4 --text "- Checking ${ROOTDIR}etc/hosts (duplicates)" --result "${STATUS_OK}" --color GREEN
|
Display --indent 4 --text "- Checking ${ROOTDIR}etc/hosts (duplicates)" --result "${STATUS_OK}" --color GREEN
|
||||||
else
|
else
|
||||||
LogText "Found duplicate line: ${sFIND}"
|
LogText "Found duplicate line: ${OUTPUT}"
|
||||||
LogText "Result: found duplicate line"
|
LogText "Result: found duplicate line"
|
||||||
Display --indent 4 --text "- Checking ${ROOTDIR}etc/hosts (duplicates)" --result "${STATUS_SUGGESTION}" --color YELLOW
|
Display --indent 4 --text "- Checking ${ROOTDIR}etc/hosts (duplicates)" --result "${STATUS_SUGGESTION}" --color YELLOW
|
||||||
ReportSuggestion "${TEST_NO}" "Remove duplicate lines in ${ROOTDIR}etc/hosts"
|
ReportSuggestion "${TEST_NO}" "Remove duplicate lines in ${ROOTDIR}etc/hosts"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user