Last active
March 29, 2021 22:33
-
-
Save vfedyay/92ea085d62dd7c4b0ff40edc00676896 to your computer and use it in GitHub Desktop.
Linux OS version
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
#!/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