So I am attempting to use expect to automate backing up the running config of some switches on our network. The problem that I'm running into is its changing a part of my send commands and I dont know how to fix it.
For example I'm using whats below.
#/usr/bin/expect
spawn /usr/bin/plink -ssh x.x.x.x
expect -exact "User Name:"
send "USERNAME\r"
expect -exact "Password:"
send "PASSWORD\r"
send "copy running-config flash:\\startup-config"
expect "Overwrite file [startup-config] ?[Yes/Press any key for no]"
send "y\r"
expect "Copy succeeded"
send "exit/r"
expect "eof"
but it ends up messing up on "flash:\\startup-config"
instead sending "flash:\startup-config"
and I'm at a loss as to what this is called (in order to search how to fix it).
Is anyone able to help with pointing me in the right direction?
"flash:\startup-config"
– GTerry Mar 23 '16 at 16:39send "... flash:\\\\startup..."
and if that fails, try 8 backslashes – glenn jackman Mar 23 '16 at 18:39send {copy running-config flash:\\startup-config}
– Johannes Kuhn Mar 23 '16 at 18:43{copy running-config.....}
and it ended up working. I'm sure the other would have worked as well, not to take anything away from your answer. Id like to give upvotes where they are due since both helped, would you be able to post as an answer? I cant seem to vote on comments. – GTerry Mar 23 '16 at 19:27