mirror of
https://github.com/MinecraftServerControl/mscs.git
synced 2024-11-15 06:48:16 -07:00
true_value: assume false if value not defined
This commit is contained in:
parent
3b5c0e1d89
commit
f397a46938
7
msctl
7
msctl
@ -358,14 +358,21 @@ getJavaMemory() {
|
||||
true_value() {
|
||||
local VALUE
|
||||
VALUE=$(echo "$1" | tr '[:upper:]' '[:lower:]')
|
||||
# Look for TRUE values.
|
||||
if [ "$VALUE" = "1" ] || [ "$VALUE" = "true" ] || [ "$VALUE" = "yes" ] || [ "$VALUE" = "on" ]; then
|
||||
# Return a true value (success).
|
||||
return 0
|
||||
fi
|
||||
# Look for FALSE values.
|
||||
if [ "$VALUE" = "0" ] || [ "$VALUE" = "false" ] || [ "$VALUE" = "no" ] || [ "$VALUE" = "off" ]; then
|
||||
# Return a false value (failure).
|
||||
return 1
|
||||
fi
|
||||
# Assume FALSE if value is not defined.
|
||||
if [ "$VALUE" = "" ]; then
|
||||
# Return a false value (failure).
|
||||
return 1
|
||||
fi
|
||||
printf "Invalid true/false value: \"$1\"\n" >&2
|
||||
# Return a false value (failure) in case of invalid true/false input.
|
||||
return 1
|
||||
|
Loading…
Reference in New Issue
Block a user