23 lines
434 B
Bash
23 lines
434 B
Bash
#!/usr/bin/expect
|
|
|
|
set USER [lindex $argv 0]
|
|
set PASSWD [lindex $argv 1]
|
|
set SSHHOST [lindex $argv 2]
|
|
set TFTP [lindex $argv 3]
|
|
set DATE [lindex $argv 4]
|
|
|
|
spawn ssh $SSHHOST -l $USER
|
|
expect "password"
|
|
send "$PASSWD\r"
|
|
expect "continue"
|
|
send "\r"
|
|
expect "#"
|
|
send "copy command-output \"show tech\" tftp $TFTP $DATE/$SSHHOST/SH-TECH.txt\r"
|
|
expect "#"
|
|
send "logout\r"
|
|
expect "log out";
|
|
send "y\r";
|
|
expect eof
|
|
exit
|
|
|