mirror of https://github.com/CISOfy/lynis.git
Added DigitsOnly function to extract only numbers from a text string
This commit is contained in:
parent
cf11b95c3f
commit
fee1961eed
|
@ -25,6 +25,7 @@
|
|||
# CheckUpdates Determine if a new version of Lynis is available
|
||||
# counttests Count number of performed tests
|
||||
# Debug Display additional information on the screen (not suited for cronjob)
|
||||
# DigitsOnly Return only the digits from a string
|
||||
# DirectoryExists Check if a directory exists on the disk
|
||||
# Display Output text to screen with colors and identation
|
||||
# ExitClean Stop the program (cleanly), with exit code 0
|
||||
|
@ -181,6 +182,23 @@
|
|||
if [ ${DEBUG} -eq 1 ]; then echo "DEBUG: $1"; fi
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Name : DigitsOnly
|
||||
# Description : Only extract numbers from a string
|
||||
# Returns : Digits only string
|
||||
################################################################################
|
||||
|
||||
DigitsOnly()
|
||||
{
|
||||
VALUE=$1
|
||||
logtext "Value is now: ${VALUE}"
|
||||
if [ ! "${AWKBINARY}" = "" ]; then
|
||||
VALUE=`echo ${VALUE} | grep -Eo '[0-9]{1,}'`
|
||||
fi
|
||||
logtext "Returning value: ${VALUE}"
|
||||
#return $VALUE
|
||||
}
|
||||
|
||||
# Display text
|
||||
Display()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue