Last active
December 24, 2020 15:57
-
-
Save alexandcote/edb74ad7d86820da6dca162fec30160c 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
#!/bin/bash | |
if [[ "$OSTYPE" == "linux-gnu"* ]]; then | |
os=linux | |
elif [[ "$OSTYPE" == "darwin"* ]]; then | |
os=macos | |
else | |
echo "OS not supported" | |
exit 1 | |
fi | |
sudo mkdir -p /opt/d; | |
sudo chown $USER /opt/d | |
url=$(wget -q -nv -O- https://api.github.com/repos/alexandcote/d/releases/latest 2>/dev/null | jq -r ".assets[] | select(.browser_download_url | contains(\"${os}-amd64\")) | .browser_download_url") | |
sudo wget -q $url -P /opt/d/ | |
sudo tar -xf /opt/d/d-${os}-amd64.tar.gz -C /opt/d/ | |
sudo rm -rf /opt/d/d-${os}-amd64.tar.gz |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment