Skip to content

Instantly share code, notes, and snippets.

@andreyev
Last active July 2, 2025 13:17
Show Gist options
  • Save andreyev/c34884942cca077b8c4cf8bf7cc3b127 to your computer and use it in GitHub Desktop.
Save andreyev/c34884942cca077b8c4cf8bf7cc3b127 to your computer and use it in GitHub Desktop.
gist-update.sh
#!/bin/bash
set -e
[[ -s .gist_id ]] || ( echo "No gist id found"; exit 1)
# .gist_id file format: '5230a387ba343d103d9b414be2215a55:gh-update.sh'
export GIST_ID=$(cat .gist_id)
STATUS_CODE=$(curl -w "%{http_code}" -s https://gist.githubusercontent.com/andreyev/${GIST_ID%%:*}/raw/${GIST_ID##*:} -o run.sh)
if [[ ${STATUS_CODE} != "200" ]]; then
echo "No gist file found"
rm run.sh
exit 1
else
bash -$- run.sh
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment