我正在使用 Socat 在 Expect 脚本中打开到 cisco 交换机的串行连接。我能够登录到交换机,但预计命令不会工作
I am using Socat to open a serial connection to a cisco switch in an Expect script. I am able to log into the switch but expect commands wont work
在 Socat 打开到 cisco 交换机的串行连接后,我的脚本没有执行。如何解决这个问题?
#!/usr/bin/expect -f
socat.exe `tty`,raw,echo=0 /dev/ttyS4,raw,echo=0,setsid,sane
after 10
send "\r"
expect "switch1>"
send "enable\r"
expect "*assword:"
send "PASSWORD\r"
expect "*#"
send "sh ip int brief\r"
反引号是 shell 的东西,而不是 Tcl/expect。期望中的等价物是
spawn socat.exe [exec tty],raw,echo=0 /dev/ttyS4,raw,echo=0,setsid,sane
在 Socat 打开到 cisco 交换机的串行连接后,我的脚本没有执行。如何解决这个问题?
#!/usr/bin/expect -f
socat.exe `tty`,raw,echo=0 /dev/ttyS4,raw,echo=0,setsid,sane
after 10
send "\r"
expect "switch1>"
send "enable\r"
expect "*assword:"
send "PASSWORD\r"
expect "*#"
send "sh ip int brief\r"
反引号是 shell 的东西,而不是 Tcl/expect。期望中的等价物是
spawn socat.exe [exec tty],raw,echo=0 /dev/ttyS4,raw,echo=0,setsid,sane