Skip to content

Commit f397a46

Browse files
committed
true_value: assume false if value not defined
1 parent 3b5c0e1 commit f397a46

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

msctl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,14 +358,21 @@ getJavaMemory() {
358358
true_value() {
359359
local VALUE
360360
VALUE=$(echo "$1" | tr '[:upper:]' '[:lower:]')
361+
# Look for TRUE values.
361362
if [ "$VALUE" = "1" ] || [ "$VALUE" = "true" ] || [ "$VALUE" = "yes" ] || [ "$VALUE" = "on" ]; then
362363
# Return a true value (success).
363364
return 0
364365
fi
366+
# Look for FALSE values.
365367
if [ "$VALUE" = "0" ] || [ "$VALUE" = "false" ] || [ "$VALUE" = "no" ] || [ "$VALUE" = "off" ]; then
366368
# Return a false value (failure).
367369
return 1
368370
fi
371+
# Assume FALSE if value is not defined.
372+
if [ "$VALUE" = "" ]; then
373+
# Return a false value (failure).
374+
return 1
375+
fi
369376
printf "Invalid true/false value: \"$1\"\n" >&2
370377
# Return a false value (failure) in case of invalid true/false input.
371378
return 1

0 commit comments

Comments
 (0)