使用 expect 完成自动交互的3种方式
参考文档:Shell 编程 免交互 expectexpect脚本编写以 #!/usr/bin/expect 开头的脚本,缺点是只能执行 expect 相关命令,不能执行 ls, pwd 等其他命令。示例:#!/usr/bin/expectset timeout 30# 上传文件到服务器spawn scp target/test-service.jar [email protected]:/rootexpect "[email protected]'s password: "send "
原创
2020-12-02 11:21:57 ·
498 阅读 ·
0 评论