Last active
August 29, 2015 14:07
-
-
Save hisamekms/5b754078d532b38f1a5b to your computer and use it in GitHub Desktop.
Yes/Noで答えるプロンプト ref: http://qiita.com/hisamekms/items/b8b07a64facff399c721
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
#!/bin/zsh | |
while true; do | |
read Answer\?'Do you like coffee? [Y/n]' | |
case $Answer in | |
'' | [Yy]* ) | |
echo Yes! | |
break; | |
;; | |
[Nn]* ) | |
echo No! | |
break; | |
;; | |
* ) | |
echo Please answer YES or NO. | |
;; | |
esac | |
done |
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
#!/bin/bash | |
while true; do | |
read -p 'Do you like coffee? [Y/n]' Answer | |
case $Answer in | |
'' | [Yy]* ) | |
echo Yes! | |
break; | |
;; | |
[Nn]* ) | |
echo No! | |
break; | |
;; | |
* ) | |
echo Please answer YES or NO. | |
esac | |
done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment