|
楼主 |
发表于 2003-10-12 13:17:28
|
显示全部楼层
利用interact搞定
#!/usr/bin/expect
spawn /usr/bin/telnet 192.168.0.1
expect "login"
send " MyID\r"
expect "assword:"
send "MyPasswd\r"
set CTRLZ \032
interact {
-reset $CTRLZ {exec kill -STOP [pid]}
\001 {send_user "you typed a control-A\n";
send "\001"
}
$ {send_user "The date is [exec date]."}
\003 exit
foo {send_user "bar"}
~~
} |
|