[Fix] `set -u`: ensure that potentially unbound variables aren’t called unchecked.

This commit is follow up for 853afbf.
Fixes remaining bug in #1363
Jumpei Ogawa 2017-04-27 20:17:21 +09:00 committed by Jordan Harband
parent 0a95e77000
commit caa7de37af
No known key found for this signature in database
GPG Key ID: 64A196AEE0916D55
1 changed files with 3 additions and 3 deletions

6
nvm.sh
View File

@ -2449,7 +2449,7 @@ nvm() {
if nvm_is_version_installed "$VERSION"; then
nvm_err "$VERSION is already installed."
if nvm use "$VERSION" && [ ! -z "$REINSTALL_PACKAGES_FROM" ] && [ "_$REINSTALL_PACKAGES_FROM" != "_N/A" ]; then
if nvm use "$VERSION" && [ -n "${REINSTALL_PACKAGES_FROM-}" ] && [ "_$REINSTALL_PACKAGES_FROM" != "_N/A" ]; then
nvm reinstall-packages "$REINSTALL_PACKAGES_FROM"
fi
if [ -n "${LTS-}" ]; then
@ -2517,7 +2517,7 @@ nvm() {
else
nvm_ensure_default_set "$provided_version"
fi
if [ ! -z "$REINSTALL_PACKAGES_FROM" ] \
if [ -n "${REINSTALL_PACKAGES_FROM-}" ] \
&& [ "_$REINSTALL_PACKAGES_FROM" != "_N/A" ]; then
nvm reinstall-packages "$REINSTALL_PACKAGES_FROM"
EXIT_CODE=$?
@ -2722,7 +2722,7 @@ nvm() {
# Prepend current version
PATH="$(nvm_prepend_path "$PATH" "$NVM_VERSION_DIR/bin")"
if nvm_has manpath; then
if [ -z "$MANPATH" ]; then
if [ -z "${MANPATH-}" ]; then
local MANPATH
MANPATH=$(manpath)
fi