Terminal Hungup at the time of read

Hi,

There are two scripts. The second script is called from the first one. These will create two processes on unix. In the second script, there is a read statement in the while loop.

Under unexpected conditions, at the time of reading response from the user, if the terminal hungup happens, the subprocess is still running because of the loop. I need to stop the
subprocess if the terminal hungup happens.
I tried using trap , but it didn't work.
Any help will be greatly appreciated ? Looking for quick response.

Thanks,
kk.

[my lamer solution] in the second script, test in the loop whether ps list inclide Parent PID -

$PPID in the korn shell

$$ in the csh