#!/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 "conf\r" expect "#" send "tftp client\r" expect "#" send "exit\r" expect "#" send "copy command-output \"show tech all\" tftp $TFTP $DATE/$SSHHOST/SH-TECH-ALL.txt\r" expect "#" send "logout\r" expect "log out"; send "y\r"; expect eof exit