Skip to content

Instantly share code, notes, and snippets.

@zyriuse75
Created October 8, 2017 14:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zyriuse75/7cd67cd2946c789a68b4e2f2fc354858 to your computer and use it in GitHub Desktop.
Save zyriuse75/7cd67cd2946c789a68b4e2f2fc354858 to your computer and use it in GitHub Desktop.
def read_os_file(os_release)
if File.readable?(os_release)
File.read(os_release)
end
end
read_os_file("/etc/os-release")
=> "NAME=\"CentOS Linux\"\nVERSION=\"7 (Core)\"\nID=\"centos\"\nID_LIKE=\"rhel fedora\"\nVERSION_ID=\"7\"\nPRETTY_NAME=\"CentOS Linux 7 (Core)\"\nANSI_COLOR=\"0;31\"\nCPE_NAME=\"cpe:/o:centos:centos:7\"\nHOME_URL=\"https://www.centos.org/\"\nBUG_REPORT_URL=\"https://bugs.centos.org/\"\n\nCENTOS_MANTISBT_PROJECT=\"CentOS-7\"\nCENTOS_MANTISBT_PROJECT_VERSION=\"7\"\nREDHAT_SUPPORT_PRODUCT=\"centos\"\nREDHAT_SUPPORT_PRODUCT_VERSION=\"7\"\n\n"
icr(0.23.1) > array=[[centos, debian,red-hat]]
i would want to know if the result have CentOS .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment