summaryrefslogtreecommitdiff
path: root/scripts/yesno
blob: dd186c763ce8ef62cb61e54a52cc2c1902d24e48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#! /bin/bash
# Usage: yesno prompt...

if [ $# -eq 0 ]
then prompt="yes or no: "
else prompt="$*"
fi

while true
do
    read -p "$prompt" || exit 1
    case "$REPLY" in
    y*|Y*)	exit 0;;
    n*|n*)	exit 1;;
    *)		echo "Answer yes or no please";;
    esac
done