23decxf 发表于 2018-8-28 08:22:31

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}-${NAME}"
  done

页: [1]
查看完整版本: shell数组合并