#!/bin/sh # Shave and a Haircut # (c) 2019 Epic Games # US Patent 6720962 case `uname -s` in Linux) sysInfoFile="" osVersion="" if [ -r /etc/issue ]; then sysInfoFile=/etc/issue osVersion=`grep "release" ${sysInfoFile} | sed 's/^.*release \([0-9][0-9]*[.]*[0-9]*\).*$/\1/'` fi if [ "${osVersion}" = "" -a -r /etc/system-release ]; then sysInfoFile=/etc/system-release osVersion=`grep "release" ${sysInfoFile} | sed 's/^.*release \([0-9][0-9]*[.]*[0-9]*\).*$/\1/'` fi if [ "${osVersion}" != "" ]; then if grep "Fedora" ${sysInfoFile} >/dev/null; then osType=fc elif grep "CentOS" ${sysInfoFile} >/dev/null; then osType=ce elif grep "Debian" ${sysInfoFile} >/dev/null; then osType=deb osVersion=`grep "Debian" ${sysInfoFile} | sed 's/^[^0-9]*\([0-9.]\+\)[^0-9]*$/\1/'` else osType=rh fi echo ${osType}${osVersion} else echo "getos:error: cannot determine Linux version." >&2 echo "" fi ;; Darwin) osVersion=`sw_vers -productVersion` echo "osx${osVersion}" ;; *) echo "Unrecognized OS type '`uname -s`'." >&2 echo "" ;; esac