Skip to content

Instantly share code, notes, and snippets.

@urin
Created November 8, 2016 01:16
Show Gist options
  • Save urin/e5fac60e40dd283ac5679c1c875d60de to your computer and use it in GitHub Desktop.
Save urin/e5fac60e40dd283ac5679c1c875d60de to your computer and use it in GitHub Desktop.
RHELやCentOS系のOS情報取得
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