Created
September 19, 2022 09:39
-
-
Save krystofwoldrich/d9c528c0a22de510651beb91e452b3fe to your computer and use it in GitHub Desktop.
Get xcode version in bash
This file contains hidden or 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
#!/usr/bin/env bash | |
set -euo pipefail | |
# Matches the version number from the output of xcodebuild -version | |
# Example: 13.4.1 | |
xcodeBin=/usr/bin/xcodebuild | |
xcodeVersionOutput=$($xcodeBin -version) | |
xcodeVersion=$(echo "$xcodeVersionOutput" | perl -pe '($_)=/([0-9]+([.][0-9]+)+)/') | |
echo "$xcodeVersion" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment