1
0
Files
2022-09-29 17:59:04 +03:00

26 lines
614 B
Tcsh
Executable File

#! /bin/csh
#
# Script: cpus
# Purpose: To return the number of CPUs
# Returns: STDOUT: <CPU Type> <# cpus>
#
# Check for type of CPU (IP4/IP4.5/IP5/IP7/IP9/IP15/IP19) and how many
set tmpcpu = `hinv | grep "IP*[0-9]" | awk '{print $4}'`
if ($#tmpcpu > 1) then
@ sum = 0
foreach SPD (`hinv | grep "IP*[0-9]" | awk '{print $1}'`)
if ($SPD == Processor) then
@ sum++
else
@ sum = $sum + $SPD # Total number of CPUs
endif
end
setenv cput $sum
else
setenv cput `hinv | grep "IP*[0-9]" | awk '{print $1}'` # Number of CPUs
endif
echo $cput