Check `$#` before trying to check `$1`. Avoids failure due to `nounset` bash option.

Partially fixes #868.
Jordan Harband 2015-10-12 16:57:45 -07:00
parent 8f3ee23390
commit 84aad508f7
1 changed files with 1 additions and 1 deletions

2
nvm.sh
View File

@ -2235,7 +2235,7 @@ nvm_supports_xz() {
}
NVM_VERSION="$(nvm_alias default 2>/dev/null || echo)"
if nvm_supports_source_options && [ "_$1" = "_--install" ]; then
if nvm_supports_source_options && [ "$#" -gt 0 ] && [ "_$1" = "_--install" ]; then
if [ -n "$NVM_VERSION" ]; then
nvm install "$NVM_VERSION" >/dev/null
elif nvm_rc_version >/dev/null 2>&1; then