Chubler_XL, thanks, return works well but this is not desired action for my case.
Corona688, ygemici - thank you for explanation, now I know why.
I tried to use this knowledge and modify my script a bit and workaround it.
Please see better version below.
I created dedicated _read function, doing nothing more than calling read.
I closed it in the while loop to make sure it works more than once.
And, I'm very close...
And, it works pretty nice. Almost
It goes in some race condition in don't understand yet.
Please see output.
It died killed by USR1. I'm surprised, since I have dedicated trap for it which is defined at this time.
--bzk
---------- Post updated at 08:15 AM ---------- Previous update was at 06:55 AM ----------
New version of script.
Much more stable now.
Changes:
send KILL signal to the background process from the "trap".
make sure signal was not only sent, but also background process is not running any more.
I will let it work for couple of hours and let you know.
thanks
--bzk
---------- Post updated 12-02-11 at 04:40 AM ---------- Previous update was 12-01-11 at 08:15 AM ----------
OK, it works. but remove TMOUT from the last script I provided.
TMOUT variable has different meaning in ksh88 and ksh93. See man below:
Ksh93: TMOUT If set to a value greater than zero, TMOUT will be the default timeout value for the read built-in command. The select comĀ* pound 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 readĀ* ing from a terminal. (Note that the shell can be compiled with a maximum bound for this value which cannot be exceeded.)
ksh88: TMOUT If set to a value greater than zero, the shell terminates if a command is not entered within the prescribed number of seconds after issuing the PS1 prompt. The shell can be com- piled with a maximum bound for this value which cannot be exceeded.
Once again thanks for showing me the right track!
bzk
Greetings. This is my first post in this forum; I hope y'all find it useful. One caveat: "Concise" is my middle name. NOT! :D
I am almost done with a shell script that runs as a daemon. It monitors a message log that is frequently written to by a database server but it it works my client will... (2 Replies)
Hello,
I have used a chunk of ksh script similar to this in many places without any issue:
while :
do
print;
read OPTION?"Enter a number (q to quit): "
expr ${OPTION} + 1 >/dev/null 2>&1
CHECKVAL=$?
if }" != ${OPTION} ]; then
... (2 Replies)
I receive the following warning messages on a very new machine which has FreeBSD 8.1 x64 installed on it:
Interrupt storm detected on "irq 20" throttling interrupt source
It is unclear what this means and what its origins are (motherboard? CPU? RAM?).
I can start the desktop and the message is... (4 Replies)
hi,
I'm a newbie to shell scripting. I wanted to initialise an array using basic for loop and read it.
Then i want to print it as a .CSV file..
Any help would me much appreciated.. (1 Reply)
hello everyone,
I'm having a problem doing signal handling so I post this thread to see if I could get help.
I want asynchronous signal handling, that means when I'm processing a signal (signal 1), if the same signal comes (signal 2) that signal (signal 2) shall be processed; and moreover,... (7 Replies)
I am stuck with a problem while reading data from a file..
while
do
read line
#do some operations and if some condition is satisfied, ask the user to enter his choice.
# using the choice continue operations.
done < fileBeingRead.txt
The... (4 Replies)
Hi All,
Is there any way to read the previous line in file reading ?
or
is there any way to read a line twice in KSH ?
thanks in advance !!
Srini (6 Replies)
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 ... (2 Replies)
I have a process to terminate, and when keying Control C/ kill -int , it takes 15 minutes to half an hour to terminate the process. I've tried using kill -2, or keying control c twice, however the process seem
to be killed abruptly, without writing into the log file.
So the only way in order to... (8 Replies)