#!/bin/bash
#配合ansible远程检查主机名称是否唯一


sum=0

while read line
do
    if [ ${HOSTNAME} == ${line} ]
    then
    let sum++
    fi
    
    if [ ${sum} -gt 1 ]
    then
    echo "检查出主机名称有重复，请检查并修改"
    exit 1
    fi
done < $1