标签:shell数组合并
##/bin/bash
IP=($(grep -E -v "127.0.0.1|::" /etc/hosts | awk ‘{print $1}‘))
NAME=($(grep -E -v "127.0.0.1|::" /etc/hosts | awk ‘{print $2}‘))
Num=`grep -E -v "127.0.0.1|::" /etc/hosts|wc -l`
for i in $(seq $Num)
do
echo "${IP[i-1]}-${NAME[i-1]}"
done
本文出自 “流星宇” 博客,谢绝转载!
标签:shell数组合并
原文地址:http://8789878.blog.51cto.com/8779878/1770867