Skip to content

Instantly share code, notes, and snippets.

@sdarlington
Forked from alexrozanski/versionScript.sh
Last active January 1, 2016 21:59
Show Gist options
  • Save sdarlington/8207163 to your computer and use it in GitHub Desktop.
Save sdarlington/8207163 to your computer and use it in GitHub Desktop.
#!/bin/ksh
targetName="$1"
# Thanks to http://stackoverflow.com/a/13871762/75245 for help with the parsing.
relativeInfoPlistLocation=$(/usr/bin/xcrun xcodebuild -showBuildSettings -target ${targetName} 2>/dev/null | awk -F= '/INFOPLIST_FILE/ { print $2; }')
absoluteInfoPlistLocation=${PROJECT_DIR}/$relativeInfoPlistLocation
version=$(/usr/libexec/Plistbuddy -c 'Print :CFBundleShortVersionString' $absoluteInfoPlistLocation)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment