fix ENABLE_MAP unbound variable in reporting block
set +u was added around the ENGINE_BLOCK for-loops but the reporting
lines after ok "Updated settings.yml" still ran under set -u.
bash < 4.4 throws "unbound variable" for ${#ENABLE_MAP[@]} when the
associative array is empty (no --enable-engines argument was given).
Add set +u before the Disabled/Re-enabled info lines; it already covers
the ${#DISABLE_MAP[@]} reference at the end of the script.
https://claude.ai/code/session_012gDnantBmFTWZGCiKyjazx
This commit is contained in:
@@ -197,6 +197,9 @@ set -u
|
|||||||
} > "$SETTINGS"
|
} > "$SETTINGS"
|
||||||
|
|
||||||
ok "Updated settings.yml (safe_search: $SAFE_INT)"
|
ok "Updated settings.yml (safe_search: $SAFE_INT)"
|
||||||
|
# bash < 4.4: ${#assoc[@]} on an empty declared array throws "unbound variable"
|
||||||
|
# under set -u — disable nounset for the rest of the reporting section
|
||||||
|
set +u
|
||||||
if [[ ${#DISABLE_MAP[@]} -gt 0 ]]; then
|
if [[ ${#DISABLE_MAP[@]} -gt 0 ]]; then
|
||||||
info "Disabled (${#DISABLE_MAP[@]}): $(printf '%s, ' "${!DISABLE_MAP[@]}" | sed 's/, $//')"
|
info "Disabled (${#DISABLE_MAP[@]}): $(printf '%s, ' "${!DISABLE_MAP[@]}" | sed 's/, $//')"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user