Thursday, August 19, 2010

ShellScripts

Bash Script to find CPU type or model?

#!/bin/sh

if [ -f /proc/cpuinfo ]; then

    echo -n "MODELNAME=\""
    grep -m 1 "model name" /proc/cpuinfo | cut -d: -f2 | sed -e 's/^ *//' | sed -e 's/$/"/'
   
fi



OUTPUT:
MODELNAME="Intel(R) Core(TM)2 Duo CPU     E8200  @ 2.66GHz"