Merge pull request #366 from messju/nvm_version_fix

fixed nvm_version result when multiple versions match the given pattern
master
Jordan Harband 2014-03-15 13:17:36 -07:00
commit db4c582d79
2 changed files with 24 additions and 1 deletions

2
nvm.sh
View File

@ -51,7 +51,7 @@ nvm_version() {
PATTERN='current' PATTERN='current'
fi fi
VERSION=`nvm_ls $PATTERN` VERSION=`nvm_ls $PATTERN | tail -n1`
echo "$VERSION" echo "$VERSION"
if [ "$VERSION" = 'N/A' ]; then if [ "$VERSION" = 'N/A' ]; then

View File

@ -0,0 +1,23 @@
#!/bin/sh
set -e
. ../../nvm.sh
# Remove the stuff we're clobbering.
[ -e ../../v0.10.25 ] && rm -R ../../v0.10.25
[ -e ../../v0.10.26 ] && rm -R ../../v0.10.26
# Install from binary
nvm install 0.10.25
nvm install 0.10.26
# Check
[ -d ../../v0.10.25 ]
[ -d ../../v0.10.26 ]
# Use the first one
nvm use 0.10.25
# Use the latest one
nvm use 0.10
node --version | grep v0.10.26