数组:
引用数组:
访问数组成员
计算数组长度
数组重新赋值
如何遍历数组实例:
tee ./images.sh <<-'EOF'
#!/bin/bash
images=(
registry.cn-hangzhou.aliyuncs.com/lfy_k8s_images/kube-apiserver:v1.20.9
registry.cn-hangzhou.aliyuncs.com/lfy_k8s_images/kube-proxy:v1.20.9
registry.cn-hangzhou.aliyuncs.com/lfy_k8s_images/kube-controller-manager:v1.20.9
registry.cn-hangzhou.aliyuncs.com/lfy_k8s_images/kube-scheduler:v1.20.9
registry.cn-hangzhou.aliyuncs.com/lfy_k8s_images/coredns:1.7.0
registry.cn-hangzhou.aliyuncs.com/lfy_k8s_images/etcd:3.4.13-0
registry.cn-hangzhou.aliyuncs.com/lfy_k8s_images/pause:3.2
calico/cni:v3.22.1
calico/pod2daemon-flexvol:v3.22.1
calico/node:v3.22.1
calico/kube-controllers:v3.22.1
kubernetesui/dashboard:v2.3.1
kubernetesui/metrics-scraper:v1.0.6
)
for imageName in ${images[@]} ; do
docker save -o $imageName.docker $imageName
done
EOF
|