expect statement
All,
Im trying to write a program to ssh into a cisco box and run a certain command (write memory) on multiple devices. I think the best tool for this is using expect
Im not sure exactly sure how to write this code, but here is what im thinking:
#!/usr/bin/expect
log_user 0
spawn ssh cisco@192.168.0.1
expect "assword: "
send "password\r"
expect "\>" #shows the prompt of a cisco switch in enable mode
send "conf t"
expect "assword"
send "password\r"
expect "conf"
send "wr mem"
interact
Please let me know your thoughts
Thank you
|