Solved

Linux shell scripts: user input with 'read', but with a timeout

Posted on 2004-08-07
5
744 Views
Last Modified: 2010-04-21
Hi,

Normally, in a shell script I get input from the user by using the command:

read yesno
if [ "$yesno" == "y" ]
then
  echo Ok.
fi

However, the distribution of Linux I am using (ARM based) doesnt support for a with the 'read' command. You just can't use -t N.

Could you explain how to read a response from the user, into a variable, with a timeout. The the program has to run on ARM based linux, so it could be source code, or a utility that I can compile for Linux.
0
Comment
Question by:Risky101
5 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 11748759
what has -t to do with your posted example?
0
 
LVL 4

Accepted Solution

by:
alikoank earned 250 total points
ID: 11751315
read is a builtin command of shell.

You can always use a different shell or download the latest version of bash for your platform.
0
 

Author Comment

by:Risky101
ID: 11754096
> what has -t to do with your posted example?

made a typo in the question - it should say "However, the distribution of Linux I am using (ARM based) doesnt support timeouts with the 'read' command. You just can't use -t 5 to timeout in 5 seconds."
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question