I need to run make with one parameters set if it is running under Capitan and with other parameters in Sierra. In other words: I run in command line:
sw_version ProductName: Mac OS X ProductVersion: 10.13.6
How I can get the value of ProductVersion to the variable and check it if current OS version <10.13 then else
try the sw_vers
command. See examples here :
https://www.cyberciti.biz/faq/mac-osx-find-tell-operating-system-version-from-bash-prompt/
to get product version :
sw_vers | grep ProductVersion | cut -d':' -f2
to compare the parsed value :
base_ver=10.13
ver=$(sw_vers | grep ProductVersion | cut -d':' -f2 | tr -d ' ')
if [ $(echo -e $base_ver"\n"$ver | sort -V | tail -1) == "$base_ver" ]
then
echo "older"
else
echo "newer"
fi