01:#!/usr/bin/expect
02:
03:set PATH [lindex $argv 0]
04:set password test
05:
06:spawn scp$PATH/test.txt oracle@192.168.2.39:$PATH
07:set timeout 20
08:expect "oracle@192.168.2.39's password:"
09:set timeout 20
10:send "$password\r"
11:set timeout 20
12:send "exit\r"
13:expect eof
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/728081/viewspace-611360/
,如需转载,请注明出处,否则将追究法律责任。