install: Ensure that if a version is not provided, we don't try to shift a nonexistent argument.

master
Jordan Harband 2014-09-14 16:04:37 -07:00
parent f8054d5cae
commit 4c948cf422
1 changed files with 3 additions and 2 deletions

5
nvm.sh
View File

@ -433,19 +433,20 @@ nvm() {
fi
provided_version=$1
if [ -z "$provided_version" ]; then
if [ $version_not_provided -ne 1 ]; then
nvm_rc_version
fi
provided_version="$NVM_RC_VERSION"
else
shift
fi
[ -d "$(nvm_version_path "$provided_version")" ] && echo "$provided_version is already installed." >&2 && return
VERSION=`nvm_remote_version $provided_version`
ADDITIONAL_PARAMETERS=''
shift
while [ $# -ne 0 ]
do
ADDITIONAL_PARAMETERS="$ADDITIONAL_PARAMETERS $1"