0
Ciscoルータ経由でCisco Wireless LAN Controllerに接続するための非常に簡単なスクリプトがあります。 私の問題は、いくつかのコマンドがすべての文章を終わらせることなく、エラーなしで突然停止することを期待した後です。 問題は*パスワードからだと思いますが、わかりません。 、またbash expect *** after stop ***
spawn telnet X.Y.Z.W
Trying X.Y.Z.W...
Connected to X.Y.Z.W.
Escape character is '^]'.
User Access Verification
Username: admin
Password:
Router#telnet WLC_IP
Trying WLC_IP ... Open
(Cisco Controller)
User: admin
Password:**********
(Cisco Controller) >?
clear Clear selected configuration elements.
config Configure switch options and settings.
cping Send capwap echo packets to a specified mobility peer IP address.
debug Manages system debug options.
eping Send Ethernet-over-IP echo packets to a specified mobility peer IP address.
grep Print lines matching a pattern.
help Help
license Manage Software License
linktest Perform a link test to a specified MAC address.
logout Exit this session. Any unsaved changes are lost.
mping Send Mobility echo packets to a specified mobility peer IP address.
ping Send ICMP echo packets to a specified IP address.
reset Reset options.
save Save switch configurations.
show Display switch options and settings.
test Test trigger commands
transfer Transfer a file to or from the switch.
(Cisco Controller) >config paging disable
(Cisco Controller) >[[email protected] scripts]#
それは私のスクリプト
#!/usr/bin/expect
set timeout 10
spawn telnet X.Y.Z.W
expect "User Access Verification"
expect "Username:"
send "admin\r"
expect "Password:"
send "PASSWORD\r"
expect "Router#"
send "telnet WLC_IP\r"
expect "(Cisco Controller)"
expect "User:"
send "admin\r"
expect "Password:"
send "PASSWORD\r"
expect "Cisco Controller"
send " config paging disable\r"
expect "Cisco Controller"
send " show ap auto-rf 802.11b AP-NAME\r"
expect "Cisco Controller"
send "logout\r";
だと、これが実行した後に出力され、そこにあります "?"私はなぜそれがわからないパスワードの後に。
アイデア?
ありがとうございます!
'send"設定ページングの開始時にスペースが本当に必要ですか?\ r "'?私はそれがコマンド完了を引き起こしていると思う。 – Barmar
私はこの質問がhttp://superuser.com/にもっと適しているかもしれないと思う。 – Sufian
スペースは必要ではなく、テストだけだった、スペースがあってもなくても同じ挙動をする。 –