I'm very confused at the moment.
What I want to do is create a listener function, that wait for two commands - and the thing is it should only listen every two hundred milliseconds and ignore the other input from the user.
function foo() {
read -sN1 _input
case "${_input}" in
A) echo 'Option A';;
B) echo 'Option B';;
esac
}
while true; do
sleep 0.2
foo
done
If I "hammer" the A-key (or UP-key) ten times, it writes "Option A" ten times (although, slowly) - when it should only had time to write it at most three times. Why is that - and how do I fix it?