需求描述: 在日常运维中,假设有一批机器刚刚上线,你需要远程将本机的公钥分发到没一台服务器, 使用expect实现非交互创建会话,使用while循环读取ip.txt表里面的没一行ip地址 #!/usr/bin/bash # ssh-copy public # v1.0 by ytchen5 2020年11月21日 >good_ip.txt expect_state=$(basename $(which expect)) password=merlin username=root if [ $# -eq 0 ];then