Aqui está uma maneira de fazer isso, usando a opção -t timeout
do bash read
builtin:
#!/bin/bash
while :
do
read -t10 -p "Do you want to un-Mount the External Drives? (Y/N): "
if [ $? -gt 128 ]; then
echo "timed out waiting for user response"
break
fi
case $REPLY in
[yY]*)
echo "do it"
break
;;
[nN]*)
echo "don't do it"
break
;;
*) echo "Please enter Y or N"
;;
esac
done
Veja help read
no prompt do bash ou man bash
.