diff options
author | Michael Boelen <michael.boelen@cisofy.com> | 2019-07-13 21:05:37 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-13 21:05:37 +0300 |
commit | 6096db8828536f9b9d9912a5490f4487b96581cc (patch) | |
tree | 76f344e1dab23ae956c78b0634a70eb724f6250a /include/helper_show | |
parent | 960011967750365144ab6c1de15cae3160bb86fd (diff) | |
parent | 2dcf816e867aed02ab113a5301e20aa05f01992c (diff) |
Merge pull request #727 from Marzal/showhelperversion
Prepend sed to discard '## ' in CHANGELOG.md
Diffstat (limited to 'include/helper_show')
-rw-r--r-- | include/helper_show | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/include/helper_show b/include/helper_show index cd7d9a73..94d839be 100644 --- a/include/helper_show +++ b/include/helper_show @@ -163,15 +163,15 @@ if [ $# -gt 0 ]; then if [ ! -z "${CHANGELOG}" ]; then LogText "Result: found changelog file: ${CHANGELOG}"; break; fi done if [ ! -z "${CHANGELOG}" ]; then - SEARCH=$(egrep "^${PROGRAM_NAME} ${SEARCH_VERSION}" ${CHANGELOG}) + SEARCH=$(sed 's/^## //' ${CHANGELOG} | grep -E "^${PROGRAM_NAME} ${SEARCH_VERSION}") if [ $? -eq 0 ]; then while read -r LINE; do if [ ${STARTED} -eq 0 ]; then - SEARCH=$(echo ${LINE} | egrep "^${PROGRAM_NAME} ${SEARCH_VERSION}") + SEARCH=$(echo ${LINE} | sed 's/^## //' | grep -E "^${PROGRAM_NAME} ${SEARCH_VERSION}") if [ $? -eq 0 ]; then STARTED=1; ${ECHOCMD} "${BOLD}${LINE}${NORMAL}"; fi else # Stop if we find the next Lynis version - SEARCH=$(echo ${LINE} | egrep "^${PROGRAM_NAME} [0-9]\.[0-9]\.[0-9]") + SEARCH=$(echo ${LINE} | sed 's/^## //' | grep -E "^${PROGRAM_NAME} [0-9]\.[0-9]\.[0-9]") if [ $? -eq 0 ]; then break else @@ -186,7 +186,7 @@ if [ $# -gt 0 ]; then ${ECHOCMD} "$0 lynis show changelog [version]" ${ECHOCMD} "" ${ECHOCMD} "${HEADER}${PROGRAM_NAME} versions:${NORMAL}" - SEARCH=$(egrep "^Lynis [0-9]\.[0-9]\.[0-9] " ${CHANGELOG} | awk '{print $2}' | sort -n) + SEARCH=$(sed 's/^## //' ${CHANGELOG} | grep -E "^Lynis [0-9]\.[0-9]\.[0-9] " | awk '{print $2}' | sort -n) ${ECHOCMD} ${SEARCH} ExitFatal fi |