Created
July 22, 2017 02:35
-
-
Save ZevEisenberg/8ff5c878b07489fa9e87dc840eced348 to your computer and use it in GitHub Desktop.
Functions to copy versions of Xcode, browsers, and macOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function copySafariVersion | |
{ | |
local safariVersion=$(defaults read /Applications/Safari.app/Contents/Info CFBundleShortVersionString) | |
local safariBuild=$(defaults read /Applications/Safari.app/Contents/Info CFBundleVersion) | |
local macOSVersion=$(sw_vers -productVersion) | |
local macOSBuild=$(sw_vers -buildVersion) | |
local fullString="Safari ${safariVersion} (${safariBuild}) on macOS ${macOSVersion} (${macOSBuild})" | |
echo "Copied \"$fullString\"" | |
echo -n $fullString | pbcopy | |
} | |
function copyChromeVersion | |
{ | |
local chromeVersion=$(defaults read /Applications/Google\ Chrome.app/Contents/Info CFBundleShortVersionString) | |
local chromeBuild=$(defaults read /Applications/Google\ Chrome.app/Contents/Info CFBundleVersion) | |
local macOSVersion=$(sw_vers -productVersion) | |
local macOSBuild=$(sw_vers -buildVersion) | |
local fullString="Chrome ${chromeVersion} (${chromeBuild}) on macOS ${macOSVersion} (${macOSBuild})" | |
echo "Copied \"$fullString\"" | |
echo -n $fullString | pbcopy | |
} | |
function copyXcodeVersion | |
{ | |
local xcodePath=`xcode-select -p | rev | cut -d'/' -f3- | rev` | |
local xcodeVersion=$(defaults read "${xcodePath}"/Contents/Info CFBundleShortVersionString) | |
local xcodeBuild=$(defaults read "${xcodePath}"/Contents/Developer/Library/Frameworks/XcodeKit.framework/Versions/A/Resources/version ProductBuildVersion) | |
local macOSVersion=$(sw_vers -productVersion) | |
local macOSBuild=$(sw_vers -buildVersion) | |
local fullString="Xcode ${xcodeVersion} (${xcodeBuild}) on macOS ${macOSVersion} (${macOSBuild})" | |
echo "Copied \"$fullString\"" | |
echo -n $fullString | pbcopy | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment