python 实现自动远程登陆scp文件实例代码
python 实现自动远程登陆scp文件实例代码
实现实例代码:
#!/usr/bin/expect if {$argc!=3} { send_user "Usage: $argv0 {path1} {path2} {Password}\n\n" exit } set path1 [lindex $argv 0] set path2 [lindex $argv 1] set Password [lindex $argv 2] spawn scp ${path1} ${path2} expect { "Password:" { exec sleep 1 send "${Password}\r" } "*continue connecting*" { exec sleep 1 send "yes\r" expect "*Password:" { exec sleep 1 send "${Password}\r" } } } expect "*" send "exit\r" expect "*closed*" #send "exit\r" #expect "*" #exit #exec sleep 10
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
相关推荐
gcong 2020-03-01
huha 2016-11-24
zousongshan 2020-08-10
hulao 2020-06-13
容数据服务集结号 2020-05-19
comeonxueRong 2020-05-10
净无邪 2020-04-26
RayCongLiang 2020-03-07
服务器端攻城师 2020-02-11
wangchao 2020-01-27
mmyCSDN 2020-01-18
ZDreamST 2013-06-04
贤冰 2019-12-20
会哭的雨 2019-12-23
tycoon 2019-12-17
liujiaoyage 2019-12-13