Correct way to determine distro version in bash?

Lonnie Olson lists at
Mon Apr 8 16:59:17 MDT 2013

On Mon, Apr 8, 2013 at 4:30 PM, S. Dale Morrey <sdalemorrey at> wrote:
> This got me thinking, is there a correct way to check this sort of thing?
> Something that's going to be consistent, at least across direct derivations
> such as RHEL & CentOS?

Unfortunately some distros don't conform to LSB standards (including
CentOS), so you'll need some fallback methods.
/etc/os-release would probably be your best bet.

An example (Python) is available within the Salt source code:
Function at Line 554

More information about the PLUG mailing list