Skip to content

Instantly share code, notes, and snippets.

@chrisyip
Last active February 16, 2016 06:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisyip/8fb02770b92bf9d6d8a7 to your computer and use it in GitHub Desktop.
Save chrisyip/8fb02770b92bf9d6d8a7 to your computer and use it in GitHub Desktop.
Get latest installed node from nvm path
#!/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
#!/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