###########################################
#
#  askyn
#
#      usage:  askyn "<prompt>"
#
#  Prompts the user for a yes/no answer, using the given prompt.
#  Prompts are on stderr so that the response can be returned
#  on standard input -- intended for use with back-quote substitution.
#

prompt=$1

while true
do
	echo "$prompt [y/n] > \c" >&2
	read answer
	answer=`echo $answer | tr "[a-z]" "[A-Z]"`
	[ "$answer" = "N" -o "$answer" = "Y" ] && echo $answer && exit
	echo "Please enter \"y\" or \"n\"." >&2
done


	

