Skip to content

Instantly share code, notes, and snippets.

@jonathanhudak
Last active March 14, 2023 05:53
Show Gist options
  • Save jonathanhudak/5b9ff8a3e988204be74b80a6004a5e85 to your computer and use it in GitHub Desktop.
Save jonathanhudak/5b9ff8a3e988204be74b80a6004a5e85 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Add to your ~/.zshrc or ~/.profile
# source: https://gist.github.com/mob-sakai/174a32b95572e7d8fdbf8e6f43a528f6
gist() {
GIST_URL=$1
if [[ ! $GIST_URL ]]; then
echo -e "\nGIST_URL is required\n"
else
shift
read "REPLY?Are you sure you trust this script?" # zsh https://superuser.com/questions/555874/zsh-read-command-fails-within-bash-function-read1-p-no-coprocess
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
bash <(curl -sL ${GIST_URL}) $@
fi
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment