Update to replace an old nvm path if it exists already in $PATH.
parent
4d2e6045eb
commit
47d5982ef8
6
nvm.sh
6
nvm.sh
|
@ -78,8 +78,12 @@ nvm()
|
|||
nvm help
|
||||
return;
|
||||
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"
|
||||
fi
|
||||
export PATH
|
||||
echo "Now using node $2"
|
||||
;;
|
||||
"list" )
|
||||
|
|
Loading…
Reference in New Issue