#!/usr/bin/expect
set password 1234  #密码
#download
spawn scp /root/test.jar
root@192.168.1.2:/usr/local/ 
set timeout 300
expect "192.168.1.2's password:"
set timeout 3000
#exec sleep 1
send "$password\r"
set timeout 300
send "exit\r"
#expect eof
interact
spawn scp /root/test.jar
root@192.168.1.3:/usr/local/
set timeout 300
expect "
root@192.168.1.3's password:"
set timeout 3000
#exec sleep 1
send "$password\r"
set timeout 300
send "exit\r"
interact