#!/bin/sh a=`uname -a` b="Darwin" c="centos" d="ubuntu" if [[ $a =~ $b ]];then echo "mac" elif [[ $a =~ $c ]];then echo "centos" elif [[ $a =~ $d ]];then echo "ubuntu" else echo $a fi
shell 判断操作系统
原文:https://www.cnblogs.com/sea-stream/p/11414037.html