标签:show done redhat 执行 span expect send 实现 echo
1、添加用户tom100
#!/bin/bash while read LINES do user=`echo $LINES |cut -d ‘ ‘ -f1` password=`echo $LINES |cut -d ‘ ‘ -f2` host=`echo $LINES |cut -d ‘ ‘ -f3` expect <<EOF spawn ssh $user@$host expect "yes/no" {send "yes\r"} expect "password:" {send "$password\r"} expect "#" {send "useradd tom100\r"} send "exit\r" expect eof EOF done <ip.txt
2、ip.txt的格式
标签:show done redhat 执行 span expect send 实现 echo
原文地址:https://www.cnblogs.com/hym-by/p/12744316.html