#!/bin/expect
spawn ssh username@192.168.1.2expect "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