My script looks is this:
spawn telnet $host
.... do some stuff ....
send "exit\n"
expect { eof {puts $logfile "$expect_out(buffer)\n*******************\n";
sleep 5;
wait
}
}
Does anyone see anything wrong with this?
Mike Drons
If the exit that you are 'send'ing isn't clearly telling the
telnet session to go away, you should perhaps also use the
expect close -i spawn_id id command to force it closed.
--
Jeff Hobbs The Tcl Guy
Senior Developer http://www.ActiveState.com/
Tcl Support and Productivity Solutions
Yep. Here's the BIG RULE for Expect:
- Every exp_spawn requires a call to exp_close *and* exp_wait.
-=- D. J.
I notice that you've got your "wait" there like you're supposed to.
However, do you really want to send "exit\n" instead of "exit\r"?