ksh read timeout

Login or Register to Reply

Thread Tools Search this Thread
# 1  
ksh read timeout

any idea on how to timeout the read statement for ksh?

for bash u can use read -t option
-t timeout
Cause read to time out and return failure if a complete
line of input is not read within timeout seconds. This
option has no effect if read is not reading input from
the terminal or a pipe.

thanks in advance!
# 2  
Not sure, if this is the right answer. man ksh says

       TMOUT  If set to a positive integer in an interactive shell, it  speci-
              fies the maximum number of seconds the shell will wait for input
              after printing  the  primary  prompt  (PS1).   If  the  time  is
              exceeded, the shell exits.

# 3  
I think he means
read -t10  variable_name

This works in the newer versions of the Korn shell like Korn93. Otherwise, Perderabo has posted examples of timing out a read by using coprocesses. Search the form on read timeout.
Login or Register to Reply

Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Read timeout
I saw several thread for this issue but none addresses my issue. I have tried read -t but the result is read bad options My requirement is 1. Ask for input 2. If input = y or no input in 60 seconds then continue processing else exit fi Kindly consider this urgent.... Shell Programming and Scripting
Shell Programming and Scripting
command timeout in ksh
I probably read all the threads in almost all the forums for a solution to my need. I am a beginner in shell scripting and I dont have a perfect solution yet. Below is my code snippet. idql -n $REPOSITORY_NAME.$cs -Udmadmin -P"" -R$DM_SCRIPTS/test.api > /dev/null 2>&1 if ; then echo...... Shell Programming and Scripting
Shell Programming and Scripting
read sectors from disk failed with timeout
i'm writing some code to simulate the boot progress after power on but when i try to read the 2nd sector from a floppy disk, this operation always fail with ah=0x80h which means timeout, how can i get over this problem? my code would be like this: $ cat boot.S .code16 #define SETUPLEN 4...... UNIX for Advanced & Expert Users
UNIX for Advanced & Expert Users
KSH script SQL timeout issue
Hi all, I have a KSH script which is kicking off an sql scripts as follows: /usr/local/installs/instantclient_10_2/sqlplus -s username/password @$sql_path/sql_query.sql > $tmp_path/sql_query_results The problem I have is that sometimes the 10g Oracle Database spits out an error saying...... Shell Programming and Scripting
Shell Programming and Scripting
read from std i/p with timeout within a script
hello every one , this is my first participation in the forum , I hope it'll be a good start within a script I would like to put some code to read i\p from standard i\p using read command if it reads Y it will terminate the script if it reads N it will continue execution , if no i\p is...... Shell Programming and Scripting
Shell Programming and Scripting