Skip to content

Instantly share code, notes, and snippets.

@pi-chan
Last active August 29, 2015 13:56
Show Gist options
  • Save pi-chan/9249157 to your computer and use it in GitHub Desktop.
Save pi-chan/9249157 to your computer and use it in GitHub Desktop.
# script for incrementing short version string for Xcode.
InfoPlist="${SRCROOT}/${INFOPLIST_FILE}"
buildNumber=`/usr/libexec/PlistBuddy -c "Print CFBundleVersion" $InfoPlist`
buildNumber=`echo $buildNumber + 1.0 | bc`
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" $InfoPlist
vvv=`/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" $InfoPlist`
mm=`echo $vvv | cut -d . -f 1,2`
last=`echo $vvv | cut -d . -f 3`
last=$(($last+1))
ver=$mm.$last
/usr/libexec/PlistBuddy -c "Set CFBundleShortVersionString $ver" $InfoPlist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment