Skip to content

Instantly share code, notes, and snippets.

@ypchen
Last active June 25, 2017 14:59
Show Gist options
  • Save ypchen/aceeaf43144844f1f4275202259b690c to your computer and use it in GitHub Desktop.
Save ypchen/aceeaf43144844f1f4275202259b690c to your computer and use it in GitHub Desktop.
Execute a gist (with the specified gist hash)
#!/bin/bash
if [ -z "${1}" ]; then
echo "${0}" gist_hash [args... ]
fi
FILE_HASH="${1}"
shift
# default
if [ -z ${CURL+x} ]; then
CURL="/usr/bin/curl"
fi
# gist_user & CURL if necessary
CONF="${HOME}/.execute-gist.conf"
source ${CONF}
URL_GIST="https://gist.githubusercontent.com/${gist_user}/${FILE_HASH}/raw/"
GIST_CONTENT=`${CURL} --insecure --output - "${URL_GIST}"`
eval "${GIST_CONTENT}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment