BBS 使用expect登入

歡喜聊天區!除了有關暴力、血腥、色情與測試項目以外,都可聊!

Moderator: Forums Team

Post Reply
maxdj
Posts: 68
Joined: Sun May 11, 2003 2:08 am
Location: GCC星球

BBS 使用expect登入

Post by maxdj »

關於expect的用法
在google上找到了一些範例

Code: Select all

#!/usr/bin/expect
set timeout 20
spawn telnet 10.0.0.1
expect  "guest" { send "guest\r" } timeout { exit }
expect "請用new註冊" { send "\r" } timeout { exit }
interact
exit
可是當成功使用guest登入之後,畫面無法key in
畫面就一直卡著,畫面隨著按下enter一直往上跑
不知道是否有人對expect有研究
謝謝
scsi
Posts: 1326
Joined: Tue Oct 14, 2003 7:49 am
Contact:

Re: BBS 使用expect登入

Post by scsi »

試試看這樣子

Code: Select all

#!/usr/bin/expect
set timeout 20
spawn telnet 10.0.0.1
expect  "guest" { send "guest\r" } timeout { exit }
interact
exit
世界再大,不過是妳我之間的事
:111.gif: 欲使用GOT的ebuild請看Gentoo 台灣中文 Ebuild 使用指南
Image  我的部落格
Post Reply