Update to replace an old nvm path if it exists already in $PATH.
parent
4d2e6045eb
commit
47d5982ef8
8
nvm.sh
8
nvm.sh
|
@ -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="$NVM_DIR/$2/bin:$PATH"
|
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"
|
echo "Now using node $2"
|
||||||
;;
|
;;
|
||||||
"list" )
|
"list" )
|
||||||
|
|
Loading…
Reference in New Issue