Skip to content

Instantly share code, notes, and snippets.

@vfedyay
Last active Mar 29, 2021
Embed
What would you like to do?
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