shell数组合并
##/bin/bashIP=($(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}-${NAME}"
done
页:
[1]