1748008 Members
4193 Online
108757 Solutions
New Discussion

Expect program query

 
Vasudevan MV
Frequent Advisor

Expect program query

Hi,

I have written a small expect script which runs on A box, it telnets to B box with the given Id/pwd, then it gives control to the user. The expect program terminates for the following condition
1. When the user press ctrl+d
2. When the user type exit
3. When the user press 1 then it tries to kill all the process and then quits the program.

My question:

1. When 1 is pressed it should kill all the process apart from ksh,telnetd & PID. But I noticed that it executes the ps & grep command on A machine NOT on B. So, it says the error like "18425: no such process". How do I kill those process which are running on B box? or else is there any other way to kill all the process without killing explicitily one by one process.

2. When user press 9 anywhere (e.g $echo hello9) it tries to kill the process & terminates the program. But it should not happen like this, so how can I modify the program to avoid this condition or else is there any other command to handle this?

Thanks
Vasu