This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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