mirror of https://github.com/CISOfy/lynis.git
Add Readonly() function
This commit is contained in:
parent
0443d643da
commit
8d4fd1a7aa
|
@ -74,6 +74,7 @@
|
|||
# ParseTestValues Parse a set of values
|
||||
# PortIsListening Check if machine is listening on specified protocol and port
|
||||
# Progress Show progress on screen
|
||||
# Readonly Mark a variable as read-only data
|
||||
# Register Register a test (for logging and execution)
|
||||
# RandomString Show a random string
|
||||
# RemoveColors Reset all colors
|
||||
|
@ -2116,6 +2117,24 @@
|
|||
}
|
||||
|
||||
|
||||
################################################################################
|
||||
# Name : Readonly()
|
||||
# Description : Mark a variable as read-only data
|
||||
# Returns : nothing
|
||||
################################################################################
|
||||
|
||||
Readonly() {
|
||||
if [ $# -eq 1 ]; then
|
||||
if type -t typeset; then
|
||||
typeset -r $1
|
||||
else
|
||||
Debug "No typeset available to mark variable '$1' as read-only variable"
|
||||
fi
|
||||
else
|
||||
ExitFatal "Expected 1 parameter, received none or multiple"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
################################################################################
|
||||
# Name : Register()
|
||||
|
|
Loading…
Reference in New Issue