shell判断主机是虚机还是物理机
#!/bin/bash
product_name=`cat /sys/class/dmi/id/product_name`
if [[ "$product_name" == "KVM" ]];then
echo "主机为虚机"
else
echo "主机为物理机"
fi
shell判断主机是虚机还是物理机
#!/bin/bash
product_name=`cat /sys/class/dmi/id/product_name`
if [[ "$product_name" == "KVM" ]];then
echo "主机为虚机"
else
echo "主机为物理机"
fi