Cover V01, I01
Article
Listing 1
Listing 10
Listing 11
Listing 12
Listing 13
Listing 14
Listing 15
Listing 2
Listing 3
Listing 4
Listing 5
Listing 6
Listing 7
Listing 8
Listing 9

may92.tar


Listing 13

# ask user a yes/no question
# return Y on std output if answer is yes, else N.
# usage: ask "string"
# ( " (y/n)? " automatically appended)

if [ $# -ne 1 ]
then
echo "$0: usage: $0 <string>" >&2
exit
fi

while true
do
echo "$1 (y/n)? \c" >&2
read answer
case $answer in
n|N) echo "N"
break;;
y|Y) echo "Y"
break;;
*) echo "Please answer 'y' or 'n'..." >&2
esac
done