At the moment I'm using both
darwin_version=`uname -r` osx_version=`sw_vers -productVersion`
But if I want to display the commercial name (Lion, Mountain Lion, Mavericks, ...) I have to manually maintain a list of osx version - commercial name pair.
I'd like to avoid that manual mapping and rely on system data. Is it possible ?