Skip to content
  • anonym's avatar
    Avoid set -u issue when testing if variable is set or not. · 364a3c8d
    anonym authored
    Whenever there's a risk that we will reference a shell variable in a
    script run with `set -u` (including libraries that we sources from
    such scripts) we must reference the variable in a way so it gets a
    default value, i.e. `${VAR:-}` to give it the empty string as the
    default (which is what generally makes sense).
    
    In particular, it's quite clear that in all cases where we do
    something like `[ -n "${VAR}" ]` or `[ -z "${VAR}" ]`, where an
    expected value is the empty string, which could mean that the variable
    is not initialized, we should give such a default (as the empty
    string).
    364a3c8d