Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wshearn/e0f7e79d06d6f36ddeb8fedc6e3a7844 to your computer and use it in GitHub Desktop.
Save wshearn/e0f7e79d06d6f36ddeb8fedc6e3a7844 to your computer and use it in GitHub Desktop.
[0]Pluto:~ $ cat /etc/os-release
NAME="Ubuntu"
VERSION="16.04 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
UBUNTU_CODENAME=xenial
[0]Pluto:~ $ cat test.sh
#!/usr/bin/env bash
source /etc/os-release
if [[ "$ID_LIKE" == "debian" && "$VERSION_ID" == "16.04" ]]; then
echo "Ubuntu 16.04"
else
echo "Nope"
fi
[0]Pluto:~ $ ./test.sh
Ubuntu 16.04
[0]Pluto:~ $
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment