I am trying to implement a waiting time the user can choose to skip by pressing any key. Also it must not print anything on the terminal as I am using it to display a progress bar. I am having difficulty to catch and test user input with the further difficulty to it must not induce more delay in the total waiting time.
Here is what I have at the moment :
read -t 0 input </dev/tty1
if [[ $input -ne "" ]]; then
exit 0
fi
And that is inside a loop that update the progress bar. It succeeds not to add more delay or print unwanted lines but it doesn't fulfill its function.
-t 0 not to add further delay
reading from "/dev/tty1" not to add unwanted lines
How can I achieve this ?