1、判断当前主机的CPU生产商,其信息在/proc/cpuinfo文件中vendor_id一行中。 如果其生产商为GenuineIntel,就显示其为Intel公司; 如果其生产商为AuthenticAMD,就显示其为AMD公司; 否则,就显示无法识别;
#!/bin/bash
#########################
#File name:vendor.sh
#Version:v1.0
#Email:admin@test.com
#Created time:2022-08-19 15:01:52
#Description:
#########################
vendor=$(grep "vendor_id" /proc/cpuinfo |uniq|awk -F: '{print $NF}')
if [[ "$vendor" =~ [[:space:]]*GenuineIntel$ ]]
then
echo "intel"
elif [[ "$vendor" =~ [[:space:]]*AuthenticAMD$ ]]
then
echo "AMD"
else
echo "unknow"
fi
结果: