I am on OS X using bash and wanting to read the data in a key embedded in every Application in the Applications directory. The result seems to be the ‘defaults’ command trying to apply itself to the whole list instead of each returned Application.
#!/bin/bash
# appList=$(ls /Applications)
for APPS in "$( ls /Applications )" ; do
result=$(defaults read /Applications/"$APPS"/Contents/Info DTPlatformBuild)
done
echo result is $result
exit 0
Any help appreciated.
I am going to go with the below. The text file “appleApps.txt” is simply a listing of the default Apple Applications on a new build to abstain from the search.
A valid company application will have a new key inserted into the “Info.plist” file with a boolean set to true.
Thus we now have a mechanism to report on whether user’s are installing their own copies of Applications we already package ourselves.
Thanks for the tips as far as my errors with
$resultI read up on why not to us
lsand have learnt not to do it, as prompted by both @chris and @anubhava