I know the difference between ${var:-word}
and ${var-word}
, but I don't see the purpose of using a default value in this condition:
[ -z "${NVM_PROFILE-}" ]
I like set -u
.
$ sh -c '[ -z "NVM_PROFILE" ] && echo empty'
empty
$ sh -c 'set -u; [ -z "$NVM_PROFILE" ] && echo empty'
sh: NVM_PROFILE: unbound variable
$ sh -c 'set -u; [ -z "${NVM_PROFILE-}" ] && echo empty'
empty