You might consider explicit prompting: -p and specifying 1-character-input -n1 which allows to insert y without ENTER.
read -n1 -p "Do that? [y,n]" doit
case $doit in
y|Y) echo yes ;;
n|N) echo no ;;
*) echo dont know ;;
esac
You might consider explicit prompting: -p and specifying 1-character-input -n1 which allows to insert y without ENTER.
read -n1 -p "Do that? [y,n]" doit
case $doit in
y|Y) echo yes ;;
n|N) echo no ;;
*) echo dont know ;;
esac