2020-05-22 16:51:27 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
2020-05-23 04:12:28 +00:00
|
|
|
CPU=`cat /proc/cpuinfo | grep "model name" | head -n 1 | awk '{for (i=4; i<=NF; i++) print $i}'`
|
2020-05-22 16:51:27 +00:00
|
|
|
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
|
|
|
CPU=`sysctl -a | grep machdep.cpu.brand_string | awk '{for (i=2; i<=NF; i++) print $i}'`
|
|
|
|
else
|
|
|
|
CPU=-1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo $CPU
|