regex – 如何使用shell脚本查找Linux Distribution名称?
发布时间:2020-12-15 22:51:07 所属栏目:安全 来源:网络整理
导读:我正在编写一个 shell脚本,其中我需要当前的操作系统名称以使其通用.喜欢: if [ $Operating_System == "CentOS" ]then echo "CentOS"; # Do thiselif [ $Operating_System == "Ubuntu" ]then echo "Ubuntu"; # Do thatelse echo "Unsupported Operating Sys
我正在编写一个
shell脚本,其中我需要当前的操作系统名称以使其通用.喜欢:
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命令或其他地方应用正则表达式? 谢谢.. 解决方法$lsb_release -i Distributor ID: Fedora $lsb_release -i | cut -f 2- Fedora (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |