Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/CISOfy/lynis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Boelen <michael.boelen@cisofy.com>2019-07-05 19:35:45 +0300
committerMichael Boelen <michael.boelen@cisofy.com>2019-07-05 19:35:45 +0300
commit8d4fd1a7aa47a39375b2b6bcdab810b51b75ca01 (patch)
tree5299bad22919e29640510954157a652ca9f067fb /include
parent0443d643da1c76515fb2fb5d102d13ba25f5cb36 (diff)
Add Readonly() function
Diffstat (limited to 'include')
-rw-r--r--include/functions19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/functions b/include/functions
index a0246d68..66b6abb4 100644
--- a/include/functions
+++ b/include/functions
@@ -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()