Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- shopt -s nocasematch
- yes_or_no() {
- prompt=$1
- read -pr "${prompt}" answer
- case ${answer} in
- yes) return 0 ;;
- no) return 1 ;;
- *) yes_or_no "yesかnoで入力: " ;;
- esac
- }
- typeset -i busyday=0
- for week in 月 火 水 木 金 土 日; do
- yes_or_no "${week}曜日は?(yes/no) " && (( busyday++ ))
- done
- echo "忙しいのは${busyday}日だった"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement