-
-
Save ergoz/1f69b121cce1f3bde54ac7af66efe081 to your computer and use it in GitHub Desktop.
Bash/shell script detect/check OS and distribution (+WSL Windows Subsystem for Linux)
This file contains hidden or 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
if [[ "$OSTYPE" == "linux-gnu"* ]]; then | |
local DISTRIB=$(awk -F= '/^NAME/{print $2}' /etc/os-release) | |
if [[ ${DISTRIB} = "Ubuntu"* ]]; then | |
if uname -a | grep -q '^Linux.*Microsoft'; then | |
# ubuntu via WSL Windows Subsystem for Linux | |
else | |
# native ubuntu | |
fi | |
elif [[ ${DISTRIB} = "Debian"* ]]; then | |
# debian | |
fi | |
elif [[ "$OSTYPE" == "darwin"* ]]; then | |
# macOS OSX | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment