shell获取mac地址及获取硬盘序列号的方法

来源:互联网 发布:js特效代码酷炫 编辑:程序博客网 时间:2024/05/16 04:57
       #读取服务器的MAC地址
       MAC=$(ifconfig eth0|grep eth0|awk '{print $5}')

       #读取服务器的硬件序列号
       hdparm -I /dev/sda  > /hdSerial.txt
       hdSer=$(grep \\"Serial Number" hdSerial.txt)
       SER=$(echo ${hdSer#*:})