Exit script if the user dosent enter any data within 5 seconds

Hello friends,

Kindly help me in developing a script that asks user to enter a value and will wait for 5 seconds for the feedback. If there is no answer from the user the script will perform exit or it will continue doing something else

Ex: If yu have a multi OS system i believe while starting it will ask which one to boot and will wait for 30 seconds. The data about how much time remaining will also be dynamically displayed somewhere near to it.

Expected Output 1:
Do you want to continue (y/n) ?
Remaining seconds: 5

if the above is not possible, this one will count in background

Expected Output 2:
Do you want to continue (y/n) ?

the Remaining seconds will be updated dynamically. if this is not possible atleast the script should count in background.

Thanks.:confused::cool:

You should first check in the forums before asking questions - it has been answered before here

"Giving "read" from standard input a timeout." - the title dosent make any sense.
Can you please tell me what keyword or string have you used to get this result ?. May be i should improve my search skills. thanks.

That's alright. This is the search I did.