diff options
author | Michael Boelen <michael.boelen@cisofy.com> | 2019-03-04 14:08:47 +0300 |
---|---|---|
committer | Michael Boelen <michael.boelen@cisofy.com> | 2019-03-04 14:08:47 +0300 |
commit | e0b93ed0cc5ed00d7fb76a55c9f0dd1b31a3ac2e (patch) | |
tree | 2d04611d8093a70919b28d790a76cc7af63c423a | |
parent | ab9a53169b369d66898380c013e9d2f771578123 (diff) |
Replace awk statement with grep to simplify search
-rw-r--r-- | include/osdetection | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/osdetection b/include/osdetection index 959d3a9e..83ba2312 100644 --- a/include/osdetection +++ b/include/osdetection @@ -515,7 +515,8 @@ if [ ! -z "${OS_VERSION}" ]; then if [ -f "${DBDIR}/software-eol.db" ]; then FIND="${OS_FULLNAME}" - EOL_DATE=$(awk -v value="${FIND}" -F: '{if ($1=="os" && $2 ~ value){print $3}}' ${DBDIR}/software-eol.db | head -n 1) + # Does not work on FreeBSD: EOL_DATE=$(awk -v value="${FIND}" -F: '{if ($1=="os" && $2 ~ value){print $3}}' ${DBDIR}/software-eol.db | head -n 1) + EOL_DATE=$(grep "os:${FIND}" ${DBDIR}/software-eol.db | awk -F: '{print $3}' | head -n 1) if [ ! -z "${EOL_DATE}" ]; then NOW=$(date "+%s") FIND=$(date "+%s" --date=${EOL_DATE}) |