Operating System - Linux
1752339 Members
5588 Online
108787 Solutions
New Discussion юеВ

equivalent of "read -t 5 DUYY" on HP-UX - a timed input read ?

 
SOLVED
Go to solution
MARREEL Chris_1
Regular Advisor

equivalent of "read -t 5 DUYY" on HP-UX - a timed input read ?

Hello,

I would love to read some input from the user in a script, but he only gets a fixed amount of time to answer the question. So a read with a time-out.

Is this possible on HP-UX ?

I think in Linux the option -t x can be used on the read command, in HP-UX it is not supported.

Give me assistence,
Thanks,
Chris MARREEL
4 REPLIES 4
James R. Ferguson
Acclaimed Contributor
Solution

Re: equivalent of "read -t 5 DUYY" on HP-UX - a timed input read ?

Hi Chris:

Use 'line'.

# MYTHING=`line -t 10`

...waits 10-seconds to read from STDIN.

Regards!

...JRF...
MARREEL Chris_1
Regular Advisor

Re: equivalent of "read -t 5 DUYY" on HP-UX - a timed input read ?

Indeed this was what I'm looking for.
Thanks James !

Greetings,
Chris MARREEL
Carlos Roberto Schimidt
Regular Advisor

Re: equivalent of "read -t 5 DUYY" on HP-UX - a timed input read ?

Hi,

TMOUT
If set to a value greater than zero, TMOUT will be the default timeout value for the read built-in command. The select compound command terminates after TMOUT seconds when input is from a terminal. Otherwise, the shell will terminate if a line is not entered within the prescribed number of seconds while reading from a terminal. (Note that the shell can be compiled with a maximum bound for this value which cannot be exceeded.)

I cant test this, but i hop├Г┬й thats helpfull

Schimidt
MARREEL Chris_1
Regular Advisor

Re: equivalent of "read -t 5 DUYY" on HP-UX - a timed input read ?

thread closed