原文
vi ./Get_Dist_Name.sh #!/bin/bash Get_Dist_Name() { if grep -Eqii "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then DISTRO='CentOS' PM='yum' elif grep -Eqi "Red Hat Enterprise Linux Server" /etc/issue || grep -Eq "Red Hat Enterprise Linux Server" /etc/*-release; then DISTRO='RHEL' PM='yum' elif grep -Eqi "Aliyun" /etc/issue || grep -Eq "Aliyun" /etc/*-release; then DISTRO='Aliyun' PM='yum' elif grep -Eqi "Fedora" /etc/issue || grep -Eq "Fedora" /etc/*-release; then DISTRO='Fedora' PM='yum' elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then DISTRO='Debian' PM='apt' elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then DISTRO='Ubuntu' PM='apt' elif grep -Eqi "Raspbian" /etc/issue || grep -Eq "Raspbian" /etc/*-release; then DISTRO='Raspbian' PM='apt' else DISTRO='unknow' fi echo $DISTRO; } Get_Dist_Name

相关文章:

  • 2021-07-22
  • 2022-12-23
  • 2022-03-03
  • 2022-12-23
  • 2022-12-23
  • 2021-12-18
  • 2021-11-29
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-21
  • 2021-08-15
  • 2022-12-23
  • 2022-12-23
  • 2022-01-05
相关资源
相似解决方案