您可以使用如下 shell 脚本来显示当前 CPU 型号和数量:
#!/bin/bash
# 获取 CPU 型号
model=$(grep 'model name' /proc/cpuinfo | head -n 1 | cut -d ':' -f 2 | xargs)
# 获取 CPU 数量
num=$(grep 'model name' /proc/cpuinfo | wc -l)
# 输出结果
echo "当前 CPU 型号:$model"
echo "当前 CPU 数量:$num"