Created
September 6, 2018 18:27
-
-
Save J-Swift/6ababe2dc12efa6a9b5d49ed4ae86584 to your computer and use it in GitHub Desktop.
Get swift toolchain id from toolchain download name
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 | |
readonly target_swift_toolchain_name='swift-4.1.3-RELEASE.xctoolchain' | |
readonly toolchain_plist_file_path="/Library/Developer/Toolchains/${target_swift_toolchain_name}/Info.plist" | |
if [ ! -f "${toolchain_plist_file_path}" ]; then | |
echo | |
echo "ERROR: no toolchain found at [${toolchain_plist_file_path}]" | |
exit 1 | |
fi | |
grep -A 1 'CFBundleIdentifier' "${toolchain_plist_file_path}" | tail -1 \ | |
| sed 's/\<string\>//' | sed 's/\<\/string\>//' \ | |
| grep -Eo '\S+' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment