#!/usr/bin/expect set port [lindex $argv 0] set ip 172.29.118 set timeout -1 spawn ssh root@$ip.$port rm -rf /root/rfic.out *.txt expect { "password" {send "root\r"} } expect eof set timeout -1 spawn scp -r ../rf/out/app/rfic.out root@$ip.$port:/root/ expect { "password" {send "root\r"} } expect eof set timeout -1 spawn ssh root@$ip.$port sync; expect { "password" {send "root\r"} } expect eof