Random puzzle for the day. I had an issue that I was over thinking and did not realize the vendor just changed the application name, but it raised a question that I wanted to solve for funzies.
You have a plist that you need to read CFBundleGetInfoString from (not that this ever happens), but the path to the plist has a random folder name in it (the example I was working on is the application vendor uses a random string at the end of the app name for whatever reason). Due to the variable, defaults cannot be used to read the plist. I was using find which works fine locally to identify the path of the plist but would take too long for an extension attribute and would make check-ins take too long.
find /Applications -name "*.app" -print | grep "/Remote Support Customer Client.app/Contents/Info.plist" | while readplist; do defaults read "$plist" | grep CFBundleGetInfoString | awk -F'"' '{print substr($2, 1, 8)}' done
~ % defaults read /Applications/.com.Application.scc.66ABEF6D/Remote\\ Support\\ Customer\\ Client.app/Contents/Info.plist | grep CFBundleGetInfoString | awk -F'"' '{print substr($2, 1, 6)}'
24.1.2
Again, Jamf is getting the data we need, I was curious of how to accomplish the task. Jamf is clearly doing it already, possibly even using the find command, but I was wondering if any of you guys have a different way to approach this?