Last active
February 16, 2016 06:03
-
-
Save chrisyip/8fb02770b92bf9d6d8a7 to your computer and use it in GitHub Desktop.
Get latest installed node from nvm path
This file contains hidden or 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
#!/usr/bin/env sh | |
if [ -d "$(brew --prefix)/Cellar" ]; then | |
node=`find /usr/local/Cellar -name node | grep iojs/.*/bin/node` | |
if [ ! -z "$node" ]; then | |
$node $@ | |
else | |
echo "io.js not installed" | |
fi | |
else | |
echo "Homebrew folder not found" | |
fi |
This file contains hidden or 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
#!/usr/bin/env sh | |
# Change this to your nvm path | |
nvm_path="$HOME/.nvm/versions" | |
if [ -d $nvm_path ]; then | |
node=`find $nvm_path/**/*/bin/node | sort -nr | cut -f2` | |
if [ ! -z "$node" ]; then | |
for n in $node | |
do | |
$n $@ | |
break | |
done | |
else | |
echo "node.js or io.js not installed" | |
fi | |
else | |
echo "nvm folder not found" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment