Python 官方文档:入门教程 => 点击学习
python 实现自动远程登陆scp文件实例代码 实现实例代码: #!/usr/bin/expect if {$arGC!=3} { send_user "Usage: $argv0 {path1
python 实现自动远程登陆scp文件实例代码
实现实例代码:
#!/usr/bin/expect
if {$arGC!=3} {
send_user "Usage: $argv0 {path1} {path2} {PassWord}nn"
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 "yesr"
expect "*Password:" {
exec sleep 1
send "${Password}r"
}
}
}
expect "*"
send "exitr"
expect "*closed*"
#send "exitr"
#expect "*"
#exit
#exec sleep 10
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
--结束END--
本文标题: python 实现自动远程登陆scp文件实例代码
本文链接: https://lsjlt.com/news/13612.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-03-01
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0