From 989a51b2e05304f89a0a4c7de46a20f9685daa25 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sat, 1 Apr 2023 15:02:32 +0200 Subject: [PATCH] Add function for checking truthfulness of value --- compile.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/compile.sh b/compile.sh index 453ab27..e34fffe 100755 --- a/compile.sh +++ b/compile.sh @@ -12,7 +12,16 @@ then exit; fi; +function is_truthy() { + local value; + value="$1"; + [ ! -z "$value" ] || + [ "$value" != "0" ] || + [ "$value" != "false" ] || + [ "$value" != "n" ] || + [ "$value" != "no" ]; +} function handle_status() { if [ $1 -ne 0 ]; then @@ -216,7 +225,7 @@ then errorPatterns+=("\(\)\(.*\)\(([[:digit:]]\+): \(warning\|note\|error\): \([A-Z0-9]\+: \)\?.*\)$") errorPatterns+=("\(\"\)\(.*\)\(\", line [[:digit:]]\+\( (column [[:digit:]]\+)\)\?: \(Warning\|Error\): [A-Z0-9]\+: .*\)$"); - if [ ! -z "${USE_WINDOWS_PATHS}" ] + if is_truthy "${USE_WINDOWS_PATHS}" then echo "Help me! I am forced to use windows paths, omgg!"; fixCommand="wslpath -m";