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

 

posted @ 2019-02-07 19:33  effortsing  阅读(169)  评论(0编辑  收藏  举报