Created
November 8, 2016 01:16
-
-
Save urin/e5fac60e40dd283ac5679c1c875d60de to your computer and use it in GitHub Desktop.
RHELやCentOS系のOS情報取得
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get_os_info() { | |
local desc=$(cat /etc/*-release | uniq) | |
local ver=$(echo $desc | sed 's/.* release \(\S*\) .*/\1/') | |
local arch=$(uname -m) | |
case $desc in | |
Red*) | |
local os=RHEL | |
;; | |
CentOS*) | |
local os=CentOS | |
;; | |
*) | |
local os=Unknown | |
;; | |
esac | |
export os_name=$os | |
export os_ver=$ver | |
export os_arch=$arch | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment