cc-wrapper: fix bool handling for empty and zero values
Before the code would fail silently for zero values and with some output for empties. We now currently handle both via defaulting value to zero and making `let` return success error code when there's no syntax error.
This commit is contained in:
parent
1d15dadbec
commit
9a9c2e6579
@ -25,7 +25,11 @@ mangleVarBool() {
|
||||
for infix in "${role_infixes[@]}"; do
|
||||
local inputVar="${var/+/${infix}}"
|
||||
if [ -v "$inputVar" ]; then
|
||||
let "${outputVar} |= ${!inputVar}"
|
||||
# "1" in the end makes `let` return success error code when
|
||||
# expression itself evaluates to zero.
|
||||
# We don't use `|| true` because that would silence actual
|
||||
# syntax errors from bad variable values.
|
||||
let "${outputVar} |= ${!inputVar:-0}" "1"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user