Sourcing a shared library a second time fails with `bash: CONFIG_DIR: readonly variable`, and the script exits under `set -e`.
IntermediateTroubleshootingTroubleshooting: quoting, expansion and tool-input bugs
Answer
Likely causes → The library declares readonly CONFIG_DIR=... at load time and is sourced twice (directly and through another library).
Diagnose → grep -rn 'source\|^\. ' bin/ lib/ to see the include graph.
Fix → Add a load guard at the top of the library:
[[ -n ${_COMMON_LOADED:-} ]] && return 0
readonly _COMMON_LOADED=1
Or avoid readonly for values that callers may legitimately set.
Prevent → Libraries define functions and defaults only; they must be safe to source repeatedly.
More on Troubleshooting: quoting, expansion and tool-input bugs
`bash: [: too many arguments`Beginner`bash: [: =: unary operator expected`BeginnerA disk check fails with `[: 93%: integer expression expected`Beginner`rm $file` fails with `rm: cannot remove 'monthly': No such file or directory` and `rm: cannot remove 'report.csv'`.BeginnerA cleanup script logs `cp: cannot stat '/var/log/app/*.log': No such file or directory` on quiet days.Beginner`echo "start" > $logfile` fails with `bash: $logfile: ambiguous redirect`Intermediate