Re: spawn and ssh problem

At 2008-07-08 10:15AM, "zhouvian@xxxxxxxxx" wrote:
I have the below codes to login a server

proc login {userId serverIp} {
spawn ssh -l $userId $serverIp

set prompt "(%|#|\\\\$)"
while {1} {
expect {
-nocase "password:" {
exp_send "123456\n"
-re $prompt {
return $spawn_id
eof {
puts "eof"
timeout {
puts "timout"

In the eof and timeout cases, you're still stuck in the infinite loop.

Glenn Jackman
Write a wise saying and your name will live forever. -- Anonymous

Relevant Pages