Skip to content

Instantly share code, notes, and snippets.

@dgdavid
Last active September 18, 2018 11:42
Show Gist options
  • Save dgdavid/254f3125e16b4321cfc36755b7f691b8 to your computer and use it in GitHub Desktop.
Save dgdavid/254f3125e16b4321cfc36755b7f691b8 to your computer and use it in GitHub Desktop.
Simple example of how to get the VERSION_ID from /etc/os-release in a shell script
#!/usr/bin/env bash
# See https://www.freedesktop.org/software/systemd/man/os-release.html
version_id=$(grep "^ID=" /etc/os-release | cut -d'=' -f2 | tr -d '"')
echo $version_id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment