Update to replace an old nvm path if it exists already in $PATH.

master
Tim Caswell 2010-04-19 10:22:28 -05:00
parent 4d2e6045eb
commit 47d5982ef8
1 changed files with 6 additions and 2 deletions

6
nvm.sh
View File

@ -78,8 +78,12 @@ nvm()
nvm help nvm help
return; return;
fi fi
# TODO: Remove old nvm paths before adding this one if [[ $PATH == *$NVM_DIR/*/bin* ]]; then
PATH=${PATH%$NVM_DIR/*/bin*}$NVM_DIR/$2/bin${PATH#*$NVM_DIR/*/bin}
else
PATH="$NVM_DIR/$2/bin:$PATH" PATH="$NVM_DIR/$2/bin:$PATH"
fi
export PATH
echo "Now using node $2" echo "Now using node $2"
;; ;;
"list" ) "list" )