简单思路

(1)创建一个文件file用于存放username,hostIp ,password

(2)编写expect,用于登录服务器

(3)编写一个shell脚本,在脚本中循环调用expect程序进行批量管理服务器

一、用vim编辑器创建file

二、编写expect程序

小白之-----------shell脚本批量管理服务器

[email protected]*就是登录成功后接收到的类似下图语句的正则表达式

小白之-----------shell脚本批量管理服务器

三、编写shell脚本,循环执行expect程序

小白之-----------shell脚本批量管理服务器

四、测试

小白之-----------shell脚本批量管理服务器

小白之-----------shell脚本批量管理服务器

相关文章:

  • 2022-12-23
  • 2022-02-14
  • 2021-06-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-11
猜你喜欢
  • 2021-12-11
  • 2022-12-23
  • 2022-12-23
  • 2021-10-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案