Skip to content

Instantly share code, notes, and snippets.

@KenG98 KenG98/nvminit.sh
Created Dec 11, 2018

Embed
What would you like to do?
Putting NVM init into a function
# PUT THESE LINES
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# INTO A FUNCTION
function initnvm {
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
}
# THEN RUN THE FUNCTION WHEN YOU NEED NVM
initnvm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.