-
-
Save loucyx/e239528fbcc4bba9ae2ef406f197df0c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [ -s "$HOME/.nvm/nvm.sh" ] && [ ! "$(type -f __init_nvm)" = function ]; then | |
export NVM_DIR="$HOME/.nvm" | |
[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion" | |
declare -a __node_commands=(nvm `find -L $NVM_DIR/versions/*/*/bin -type f -exec basename {} \; | sort -u`) | |
function __init_nvm() { | |
for i in "${__node_commands[@]}"; do unalias $i; done | |
. "$NVM_DIR"/nvm.sh | |
unset __node_commands | |
unset -f __init_nvm | |
} | |
for i in "${__node_commands[@]}"; do alias $i='__init_nvm && '$i; done | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thank you. for macos osx, I didn't have
nvm.sh
in $NVM_HOME, so here's my fix: