Created
September 3, 2018 12:26
-
-
Save samhk222/c284a326b860eaebb76e4597defdd781 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
inquire () { | |
echo -n "$1 [y/n]? " | |
read answer | |
finish="-1" | |
while [ "$finish" = '-1' ] | |
do | |
finish="1" | |
if [ "$answer" = '' ]; | |
then | |
answer="" | |
else | |
case $answer in | |
y | Y | yes | YES ) answer="y";; | |
n | N | no | NO ) answer="n";; | |
*) finish="-1"; | |
echo -n 'Invalid response -- please reenter:'; | |
read answer;; | |
esac | |
fi | |
done | |
} | |
... other stuff | |
inquire "Install now?" | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment