Skip to content

Instantly share code, notes, and snippets.

@kholisrag
Created February 4, 2020 18:30
Show Gist options
  • Save kholisrag/ffe87d123ab8c87b5a0be805f09af2de to your computer and use it in GitHub Desktop.
Save kholisrag/ffe87d123ab8c87b5a0be805f09af2de to your computer and use it in GitHub Desktop.
Install Digital Ocean doctl latest version automatically (bash script / shell script)
#!/bin/bash
function install_doctl() {
echo "Install doctl"
curl -L $(curl -s https://api.github.com/repos/digitalocean/doctl/releases/latest \
| grep browser_download_url \
| grep linux-amd64 \
| cut -d '"' -f 4) \
| tar xvz
mv ./doctl /usr/local/bin
}
function main () {
if [[ $EUID -ne 0 ]]; then
sudo $(realpath "$0")
exit
fi
install_doctl
echo "All Done..."
}
main "$@"
@kholisrag
Copy link
Author

this script will prompt super user password if you running it for non-root user

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment