My script is not executing after Socat opens a serial connection to a cisco switch. How to fix this?
#!/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"
CodePudding user response:
Backticks are a shell thing, not Tcl/expect. The equivalent in expect would be
spawn socat.exe [exec tty],raw,echo=0 /dev/ttyS4,raw,echo=0,setsid,sane