for循环嵌套
#!/bin/bash #定义变量 export NODE_NAMES=(test1 test2 test3 test4) export NODE_IPS=(192.168.0.91 192.168.0.92 192.168.0.93 192.168.0.94) for node_name in ${NODE_NAMES[*]} do for node_ip in ${NODE_IPS[*]} do scp /root/ssl/kubelet-bootstrap-${node_name}.kubeconfig root@${node_ip}:/etc/kubernetes/kubelet-bootstrap.kubeconfig done done