Script OS limitations

rhooper
Contributor III

Hello all,
I have a numb question that we have never actually dealt with in the past.6f033e39819c49dfb4892da584cf6f67

We are trying to limit a script to only those devices that meet certain OS values. I have the limitations set to: 10.13.4, 10.13.5, 10.13.6, 10.14.1, 10.14.
Wondering if I enter in 10.14 or 10.14.x will that perform the same thing as having to write the 10.14.1, 10.14.2, 10.14.3... so that when time comes I don't have to go in and change the values to search for that criteria as well?

2 REPLIES 2

sshort
Valued Contributor

Yeah, 10.14.x,10.13x,10.12.x etc will do the trick.

tak10
Contributor II

You could also add the check within the script.

#!/bin/sh
# Verify OS version is 10.13 or later
osMinor=$(/usr/bin/sw_vers -productVersion | awk -F. {'print $2'})
if [[ $osMinor -ge 13 ]];
then
    echo "detected macOS 10.$osMinor"
    <YOUR CODE HERE>
else
   echo "macOS 10.$osMinor not supported"
   exit 0
end