writing a simple script to get total number of cpus/cores in server

view full story

http://www.unix.com – Hi, I am very new to scripting and I wanted to write a unix shell script which can give me, 1)number of cpu's in a box 2)number of cores per cpu 3)total number of cores in abox (ie multiplying 1&2) I am also trying to figure out how to check if hyper-threading is enabled in the server and also this check to script. intially I am looking this to run on linux then wanted to implement it on other flavours of unix. below is my script.. Code: #!/bin/sh if [ ! -r /proc/cpuinfo ]; then   echo "Is this Linux? Cannot find or read /proc/cpuinfo"   exit 1 fi ec (HowTos)