mirror of
https://github.com/deajan/obackup.git
synced 2024-11-12 19:03:42 +01:00
Kept IsNumeric expand for variable variables
This commit is contained in:
parent
cd3da2d589
commit
2346594adc
@ -146,7 +146,7 @@ function CheckCurrentConfig {
|
||||
# Check all variables that should contain a numerical value >= 0
|
||||
declare -a num_vars=(BACKUP_SIZE_MINIMUM SQL_WARN_MIN_SPACE FILE_WARN_MIN_SPACE SOFT_MAX_EXEC_TIME_DB_TASK HARD_MAX_EXEC_TIME_DB_TASK COMPRESSION_LEVEL SOFT_MAX_EXEC_TIME_FILE_TASK HARD_MAX_EXEC_TIME_FILE_TASK BANDWIDTH SOFT_MAX_EXEC_TIME_TOTAL HARD_MAX_EXEC_TIME_TOTAL ROTATE_SQL_COPIES ROTATE_FILE_COPIES KEEP_LOGGING MAX_EXEC_TIME_PER_CMD_BEFORE MAX_EXEC_TIME_PER_CMD_AFTER)
|
||||
for i in "${num_vars[@]}"; do
|
||||
test="if [ $(IsInteger \"\$$i\") -eq 0 ]; then Logger \"Bogus $i value defined in config file. Correct your config file or update it with the update script if using and old version.\" \"CRITICAL\"; exit 1; fi"
|
||||
test="if [ $(IsNumericExpand \"\$$i\") -eq 0 ]; then Logger \"Bogus $i value defined in config file. Correct your config file or update it with the update script if using and old version.\" \"CRITICAL\"; exit 1; fi"
|
||||
eval "$test"
|
||||
done
|
||||
|
||||
|
@ -837,7 +837,7 @@ function EscapeSpaces {
|
||||
echo "${string// /\\ }"
|
||||
}
|
||||
|
||||
function IsNumericOld {
|
||||
function IsNumericExpand {
|
||||
eval "local value=\"${1}\"" # Needed eval so variable variables can be processed
|
||||
|
||||
local re="^-?[0-9]+([.][0-9]+)?$"
|
||||
@ -861,7 +861,7 @@ function IsNumeric {
|
||||
function IsInteger {
|
||||
local value="${1}"
|
||||
|
||||
if [[ $value =~ ^[0-9]?$ ]]; then
|
||||
if [[ $value =~ ^[0-9]+$ ]]; then
|
||||
echo 1
|
||||
else
|
||||
echo 0
|
||||
|
Loading…
Reference in New Issue
Block a user