- 论坛徽章:
- 0
|
脚本代码如下:- #!/usr/local/bin/expect
-
- spawn telnet 192.168.150.205
-
- set port [ lindex $argv 1 ]
-
- expect "Password:"
-
- send "123456\r"
-
- expect "<sw100m03>"
-
- send "system-view\r"
-
- expect "System"
-
-
- send "interface Ethernet 1/0/$port\r"
-
- expect "sw100m03-Ethernet1/0/$port"
-
- send "port hybrid pvid vlan 1\r"
复制代码 出现错误如下:
spawn telnet 192.168.150.205
Trying 192.168.150.205...
Connected to 192.168.150.205 (192.168.150.205).
Escape character is '^]'.
********************************************************************************
* Copyright(c) 1998-2006 Huawei Technologies Co., Ltd. All rights reserved. *
* Without the owner's prior written consent, *
* no decompiling or reverse-engineering shall be allowed. *
********************************************************************************
Login authentication
Password:
<sw100m03>
%Jun 20 08:34:40:668 2000 sw100m03 SHELL/5/LOGIN:- 1 - VTY(192.168.150.203) in unit1 loginsystem-view
System View: return to User View with Ctrl+Z.
[sw100m03]interface Ethernet 1/0/
^
% Wrong parameter found at '^' position.
个人感觉是因为使用变量port导致的,但是不明白为什么会出现这样的错误,还请大侠们指教 |
|