管理机上需要安装expect包yum -y install expect1.定义主机ip[root@localhost ~]# cat ip.txt 192.168.1.12192.168.1.132.定义脚本内容[root@localhost ~]# cat script.sh vmstat3、shell嵌套expect脚本[root@localhost ~]# cat command.sh#!/bin/bashpasswd='12345678'sc=$(cat script.sh) cat ip.txt | while read linedo /usr/bin/expect <