get_char()
{
SAVEDSTTY=`stty -g`
stty -echo
stty raw
dd if=/dev/tty bs=1 count=1 2> /dev/null
stty -raw
stty echo
stty $SAVEDSTTY
}
printf "press any key or RETRUN to quit: "
c=`get_char`
bash中也可以:
read -p "press any key to continue:" -n 1 abc