Created
July 31, 2017 18:54
-
-
Save ptb/06045623d4457cce2b7e0c62bcfb888e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/sh | |
function ask() { | |
function y() { printf " \e[3;32m%s\e[0m\n" "yes"; } | |
function n() { printf " \e[3;31m%s\e[0m\n" "no"; } | |
printf "\e[1;34m%s\e[0m? \e[1;33m%s\e[0m " "${1}" "(y/n)" | |
for i in {1..3}; do | |
read -s -n 1 -t 2 | |
case "$REPLY" in | |
Y|y) y; return 0; break;; | |
N|n) n; return 1; break;; | |
*) printf "\033[1;32m%s\033[0m" "." | |
esac | |
done | |
y; return 0 | |
} | |
if ask 'Update getting started documentation'; then | |
echo "Whoo!" | |
else | |
echo "Nope." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment