Skip to content

Instantly share code, notes, and snippets.

@karlcow

karlcow/bv.sh Secret

Last active Jun 9, 2022
Embed
What would you like to do?
collect the version numbers of browsers
#!/bin/zsh
APP_PATH="/Applications/"
INFO_PATH=".app/Contents/Info.plist"
browsers=("Safari Technology Preview" "Firefox Nightly" "Google Chrome Canary" "Safari" "Firefox" "Google Chrome" "Microsoft Edge Canary")
for browser_name in ${(@k)browsers}; do
full_path="${APP_PATH}${browser_name}${INFO_PATH}" ;
if test -f "$full_path"; then
browser_version=$(defaults read "$full_path" CFBundleShortVersionString);
echo "${browser_name} ${browser_version}";
fi
done
@karlcow
Copy link
Author

karlcow commented Jun 8, 2022

The result will be something like:

Safari Technology Preview 15.4
Google Chrome Canary 104.0.5107.0
Firefox Nightly 103.0a1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment