I have this bash script which basically starts the web and selenium servers with progress indicator. Since it takes some time to selenium server to start I'm checking the status in an infinite loop.
The problem is, while waiting for it to start I press keys accidentaly it's displayed in the screen and if the loop ends (times out) it's also displayed in the command prompt too.
I want to disable all user input (except the control keys of course) while inside the loop:
start_selenium() {
echo -n "Starting selenium server"
java -jar ${selenium_jar} &> $selenium_log &
# wait for selenium server to spin up! (add -v for verbose output)
i=0
while ! nc -z localhost 4444; do
sleep 1
echo -n "."
((i++))
if [ $i -gt 20 ]; then
echo
echo -e $bg_red$bold"Selenium server connection timed out"$reset
exit 1
fi
done
}