我正在编写一个shell脚本,其中我需要当前的操作系统名称以使其通用.喜欢:
@H_403_6@if [ $Operating_System == "CentOS" ] then echo "CentOS"; # Do this elif [ $Operating_System == "Ubuntu" ] then echo "Ubuntu"; # Do that else echo "Unsupported Operating System"; fi
怎么可能?在lsb_release -a命令或其他地方应用正则表达式?
谢谢..
最佳答案
@H_403_6@$lsb_release -i Distributor ID: Fedora $lsb_release -i | cut -f 2- Fedora