4

Get browsers version number on macOS (zsh)

 2 years ago
source link: https://www.otsukare.info/2022/06/10/get-browsers-version-macos-zsh
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Get browsers version number on macOS (zsh)otsukare Thoughts after a day of work

I'm not sure why I had not written this before, but it kind of hit me when doing testing this week, that I could optimize a bit more my time.

statues in the forest with a red beanny.

This is a shell (zsh) script and macOS only. It reads the version information of a list of browsers and spills them out in a nice and ready to be copied and pasted in a bug report.

#!/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

What it looks like once rendered. I need to update a couple of things.

Safari Technology Preview 15.4
Firefox Nightly 103.0a1
Safari 15.5
Firefox 99.0
Microsoft Edge Canary 104.0.1285.0

Otsukare!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK