#!/bin/bash interface=`ls /sys/class/net|grep en|awk 'NR==1{print}'` if [ ! -e /etc/adserver/.seq.info ];then #生成序列号 #时间 #d=`date +%Y%m%d` mkdir /etc/adserver/ d=`dmidecode -t 0 |grep -oP '(?<=Release Date: ).*' |awk -F ':' 'NR==1'|awk -F'/' '{print $3$1$2}'` #批次 lot='01' #mac地址 mac=`ip addr show $interface |grep -oP '(?<=ethersw{2}:w{2}:w{2}:)w{2}:w{2}:w{2}(?=sbrd)' |sed -n 's/://gp'` seq='AD001'$d$lot$mac echo $seq > /etc/adserver/.seq.info echo $seq else cat /etc/adserver/.seq.info fi echo 'Ver 1.0.0' echo 'Ver 1.0.0' echo '1'