Created
July 8, 2021 17:44
-
-
Save k3karthic/a3a10f97b951b0daee85aade642aaffa to your computer and use it in GitHub Desktop.
Update NVM
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 bash | |
## Forked from https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c | |
get_latest_release() { | |
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api | |
grep '"tag_name":' | # Get tag line | |
sed -E 's/.*"([^"]+)".*/\1/' | # Pluck JSON value | |
tr -d 'v' # Remove v | |
} | |
ver=$(get_latest_release "nvm-sh/nvm") | |
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v$ver/install.sh | bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment