expect备份n6k配置文件

#!/bin/expect
spawn ssh username@192.168.1.2
expect "password:"
send "passwd"
expect "#"
send "copy startup-config scp:\r"
expect "]"
send "\r"
expect ":"
send "management\r"
expect "server:"
send "192.168.1.1\r"
expect "username"
send "username\r"
expect "password"
send "password\r"
expect "#"
send "exit\r"
interact

#expect eof

posted @ 2018-01-22 15:59  *奥特*  阅读(99)  评论(0编辑  收藏  举报