写一个脚本:
判断当前主机的CPU生产商,其信息在/proc/cpuinfo文件中vendor id一行中。
如果其生产商为AuthenticAMD,就显示其为AMD公司;
如果其生产商为GenuineIntel,就显示其为Intel公司;
否则,就说其为非主流公司。
参考答案:
#!/bin/bash
m=`cat /proc/cpuinfo |grep vendor_id|awk -F":" '{print $2}'|tail -1`
if [ $m == "GenuineIntel" ]
then
echo "cpu is 英特尔"
elif [ $m == "AuthenticAMD" ]
then
echo "cpu is AMD"
else
echo "cpu is 非主流"
fi
shell习题-判断cpu厂商
2017年10月12日
shell习题
No Comments
aming
写一个脚本:
判断当前主机的CPU生产商,其信息在/proc/cpuinfo文件中vendor id一行中。
如果其生产商为AuthenticAMD,就显示其为AMD公司;
如果其生产商为GenuineIntel,就显示其为Intel公司;
否则,就说其为非主流公司。
参考答案: