shell 脚本查看 cpu 负载

a=`top -n 1 | grep Cpu | cut -d "," -f 2| tr -d ' ' | cut -d '%' -f 1`
cpu=a
max=50
echo $cpu
if [ $(echo "$max < $cpu"|bc) -eq 1 ]
then
echo "aaaaaaaaaaaa"
else
echo "bbbbbbbbbbbb"
fi

你可能感兴趣的:(shell 脚本查看 cpu 负载)