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