# Compare Model Identifier against Sonoma Regex compatible Macs if [[ $myModel =~ $SonomaRegEx ]]; then maxOS="14" fi
So far, it's working partially. As devices are updating inventory I am seeing them update, but on my Macbook Air (m1, 2020) it will not show up as Max OS 14. It does, however show up in a smart group where it searches for Model Identifier matching the regex.
Is there anything obvious that I am missing?
Best answer by TrentO
More than likely the issue is that the flavor of regex used in your shell's conditionals is incompatible with the flavor you are using in the smart group. For example, if your script is written in zsh, by default it does not support shortcuts such as \\d for digits. Instead you have to use the full POSIX bracket notation [[:digit:]]. In your script, \\d was interpreted as a literal "d" which meant that \\d{2} was not 2 digits but instead literally "dd". So, MacBookAir([8-9]|\\d{2}) does not match "MacBookAir10,1" but MacBookAir([8-9]|[[:digit:]]{2}) will.
**Also please note that I moved your ^ outside your parentheses so it get's applied to all of the model types. As it was written, only the Mac1[3-9] option was required to be at the beginning of the matched string.
You can't read one EA from a separate EA. You might want to try putting both calculations into a single EA instead, then using that for your Smart Group criteria.
You can't read one EA from a separate EA. You might want to try putting both calculations into a single EA instead, then using that for your Smart Group criteria.
More than likely the issue is that the flavor of regex used in your shell's conditionals is incompatible with the flavor you are using in the smart group. For example, if your script is written in zsh, by default it does not support shortcuts such as \\d for digits. Instead you have to use the full POSIX bracket notation [[:digit:]]. In your script, \\d was interpreted as a literal "d" which meant that \\d{2} was not 2 digits but instead literally "dd". So, MacBookAir([8-9]|\\d{2}) does not match "MacBookAir10,1" but MacBookAir([8-9]|[[:digit:]]{2}) will.
**Also please note that I moved your ^ outside your parentheses so it get's applied to all of the model types. As it was written, only the Mac1[3-9] option was required to be at the beginning of the matched string.
More than likely the issue is that the flavor of regex used in your shell's conditionals is incompatible with the flavor you are using in the smart group. For example, if your script is written in zsh, by default it does not support shortcuts such as \\d for digits. Instead you have to use the full POSIX bracket notation [[:digit:]]. In your script, \\d was interpreted as a literal "d" which meant that \\d{2} was not 2 digits but instead literally "dd". So, MacBookAir([8-9]|\\d{2}) does not match "MacBookAir10,1" but MacBookAir([8-9]|[[:digit:]]{2}) will.
**Also please note that I moved your ^ outside your parentheses so it get's applied to all of the model types. As it was written, only the Mac1[3-9] option was required to be at the beginning of the matched string.
Hey, thank you very much. At least on the computer that wasn't working I am seeing it fixed. Also appreciate learning what the issue was.