#!/usr/bin/expect set timeout 60 if {$argc != 3} { send "usage followed by src,dst,password" exit } set src [lindex $argv 0] set dst [lindex $argv 1] set passwd [lindex $argv 2] spawn scp $src $dst expect { "yes/no" { send "yes\n" exp_continue } "password:" { send "$passwd\n" } } expect eof
可能还有些情况不能handle
时间: 2024-10-03 23:16:47