2012-04-08 24 views
1

スイッチに関連付けられたすべてのmac-addressを含むリストをファイルに入れるためのexpectスクリプトがあります。複数の出力ページを処理するEXPECTスクリプト

#!/usr/bin/expect -f 
spawn telnet 192.168.20.222 
match_max 10000 
expect "*?to continue*" 
send -- "\r" 
send -- "show mac \r" 
expect -- "*?2626#*" 
send -- "exit \r" 
expect -- "*?2626>*" 
send -- "exit \r" 
expect "*?y/n*" 
send -- "y \r" 

このようにいろいろ書いそれはすべて正常に動作しますが、あまりにも多くのアドレスがある場合、スイッチは言うだろう: - MORE -

、次のページ:スペース、次の行を:終了し、入力します。 Control-C

もちろんN個のページがあり、N beeingは不明です。
どうすればよいですか?

答えて

3
send -- "show mac \r" 
expect { 
    "MORE --, next page" {send -- " "; exp_continue} 
    "*?2626#*" {send -- "exit \r"} 
} 
関連する問題