#!/usr/bin/expect
#trap sigwinch spawned
trap {
set rows [stty rows]
set cols [stty columns]
stty rows $rows columns $cols < $spawn_out(slave,name)
} WINCH
set ip "192.168.x.x"
set pwd "xxx"
set timeout 30
spawn ssh ubuntu@$ip
expect {
"*yes/no" {send "yes
";exp_continue}
"*password:" {send "$pwd
"}
}
interact # 保持在远程终端