Show number of CPUs

#!/bin/bash
#This script will show you amount and name of CPUs including vmware cpu's if they exist.

name="$(
cat /proc/cpuinfo | awk -F: '
/vendor_id/ { vendor=$2 }
/model name/ { model=$2 }
/cpu MHz/ {
if ( model ~ "Hz" ) {speed=""} else { speed=$2 "MHz" };
print vendor, model, speed; }
' | tail -1
)"

num=$(
if [ -r /proc/vmware/cpuinfo ]
then
awk '/pcpu/ { print NF-1 }' /proc/vmware/cpuinfo
else
cat /proc/cpuinfo | grep processor| wc -l
fi
)

# ESX: mas info sobre logical/cores/packages
if [ -r /proc/vmware/sched/ncpus ]; then
cores=$( echo $( cat /proc/vmware/sched/ncpus ) )
fi

#clear

echo "
*************************************************************
*
* `echo $num CPUs $( echo "$name ($cores)" )`
*
*************************************************************
"
##EOF##