Skip to content

Instantly share code, notes, and snippets.

@syohex
Created July 22, 2021 01:27
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 syohex/836210485d50c7fec6e419bcb08fe292 to your computer and use it in GitHub Desktop.
Save syohex/836210485d50c7fec6e419bcb08fe292 to your computer and use it in GitHub Desktop.
update gh script on Linux environment
#!/usr/bin/env bash
set -e
set -x
VERSION=$1
if [[ $VERSION == "" ]]; then
echo "Usage: update-gh version"
exit 1
fi
BASE="gh_${VERSION}_linux_amd64.tar.gz"
DIR="gh_${VERSION}_linux_amd64"
URL="https://github.com/cli/cli/releases/download/v${VERSION}/gh_${VERSION}_linux_amd64.tar.gz"
curl -LO $URL
tar xf $BASE
cp ${DIR}/bin/gh ~/bin/gh
chmod +x ~/bin/gh
rm -rf "$DIR"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment