Skip to content

Instantly share code, notes, and snippets.

@alexandcote
Last active December 24, 2020 15:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexandcote/edb74ad7d86820da6dca162fec30160c to your computer and use it in GitHub Desktop.
Save alexandcote/edb74ad7d86820da6dca162fec30160c to your computer and use it in GitHub Desktop.
#!/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