Hacker News new | ask | show | jobs
by cassianoleal 327 days ago
> I tend to skip the -u flag as bash scripts often interact with global variables that are set outside my scripts.

That's throwing the baby out with the bathwater. Instead, default the optional global variables with something like:

    "${GLOBAL_VAR:-}"
That will satisfy the optionality of the variable whilst keeping the check for the cases you actually want them.