菜鸟学linux

时间:2015-07-17 07:16:09   收藏:0   阅读:251

编写脚本:

 

   判断当前主机的CPU生产商

如果其生产商为AuthenticAMD,就显示其为AMD 公司

如果其生产商为GenuineIntel,就显示其为Intel 公司

否则,就显示为unkown


脚本编写如下:

#!/bin/bash


CPU=`grep ‘Vendor_id‘ /proc/cpuinfo |cut -d: -f2`

if [ $CPU == AuthenticAMD ];then

  echo "The CPU is AMD"

elif [ $CPU == GenuineIntel ];then

  echo "The CPU is Intel"

else

  echo "Unkown"

本文出自 “yegaopeng” 博客,请务必保留此出处http://yegaopeng.blog.51cto.com/816739/1675451

原文:http://yegaopeng.blog.51cto.com/816739/1675451

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!