Hi,
I am trying to find all installed Apps from the Mac App Store which have not been purchased through the VPP/Self Service.
This is what I got with the help of an older Script from Craig Lindsey
#!/bin/bash
# JAMF Extension Attribute that finds any MAS apps
# that were NOT purchased through VPP
# Based on Script from: Craig Lindsey for Starz 2017-2-10
checkMD=$(mdfind -onlyin /Applications/ 'kMDItemAppStoreReceiptIsVPPLicensed == "0"')
#echo "### checkMD - $checkMD"
if [ "$checkMD" = "" ]
then
echo "<result>Not Found</result>"
exit 0
fi
result=""
mdfind -onlyin /Applications/ 'kMDItemAppStoreReceiptIsVPPLicensed == "0"' | while read VPPApp
do
AppName=$( echo "$VPPApp" | awk -F'/' '{print $NF}' | sed -e 's/^"//' -e 's/"$//')
result+="$AppName"
echo "### Result - $result"
done
echo -e "### Result-TEST - $result"
#echo -e "<result>$result</result>"
exit 0
And this is the Result I get
### Result - Push Diagnostics.app
### Result - Push Diagnostics.appiMazing Profile Editor.app
### Result-TEST -
How can I transfer the $result from the loop to the end of the script?
Thanks in advance!