Overview:
This article will introduce a quick tip on how to grab all installed Applications & versions via a script. This will make it easier to distinguish between each device's applications and their version. The script will access the Applications library and from there display the appropriate name and version of said application.
------------------------------------------------------------------------------------------------------
Bash:
#!/bin/bash
# Iterate through global Applications folder
applications_folder="/Applications"
# Check if the user has an Applications folder
if [ -d "$applications_folder" ]; then
echo "Installed Applications:"
for app in "$applications_folder"/*; do
# Check if it's an application bundle
if [ -d "$app" ] && [[ "$app" =~ .app$ ]]; then
app_name=$(basename "$app")
# Get the version from the Info.plist file
info_plist="$app/Contents/Info.plist"
if [ -f "$info_plist" ]; then
app_version=$(defaults read "$info_plist" CFBundleShortVersionString)
else
app_version="Version information not found"
fi
echo "- $app_name ($app_version)"
fi
done
fi
------------------------------------------------------------------------------------------------------
Expected Output:
This is the expected output once the script gets executed, it should display the application name and version attached to it.