Skip to content

Instantly share code, notes, and snippets.

@vfedyay
Last active March 29, 2021 22:33
Show Gist options
  • Save vfedyay/92ea085d62dd7c4b0ff40edc00676896 to your computer and use it in GitHub Desktop.
Save vfedyay/92ea085d62dd7c4b0ff40edc00676896 to your computer and use it in GitHub Desktop.
Linux OS version
#!/bin/bash
if [ -f /etc/os-release ]; then
# freedesktop.org and systemd
. /etc/os-release
OS_ID=$ID
#OS=$NAME
#VER=$VERSION_ID
fi
case "$OS_ID" in
centos)
RESULT=`cat /etc/centos-release`
;;
debian)
RESULT="Debian "`cat /etc/debian_version`
;;
ubuntu)
RESULT=$PRETTY_NAME
;;
alpine)
RESULT=$NAME" "`cat /etc/alpine-release`
;;
*)
RESULT=$(umane -s)" "$(uname -r)
;;
esac
echo "$RESULT"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment