I want to capture the output of my expect script in a file.txt.
#!/usr/bin/expect -f
match_max 10000
set timeout 120
eval spawn ssh 10.0.0.0
set prompt ":|#|\\\$"
interact -o -nobuffer -re $prompt return
send "password\r"
expect ">"
send "sh cdp neighbors detail\r\r "
expect ">"
send "\n"
sleep 5
This is what I have, he reads out my cdp neighbors detail from a switch. But now I want to push this output in a file, in my directory. So I can automate doing commands on a switch, and get the output. The script works completely but I can't find enough information to read the output from an expect script.
Thanks in advance!
Omnomnom