大家好我已尝试过以下方法,但没有一个帮助我增加它而不会在命令行上出现任何错误。
我当前的内部版本号是1.4.0,我想获得1.5.0 ..
BUNDLE_VERSION=$(/usr/libexec/PlistBuddy -c "Print:CFBundleShortVersionString" <my plist path>)
BUILD_NUMBER=$(/usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionString" <my plist path>)
#BUILD_NUMBER=`echo $BUILD_NUMBER +1|bc` //have tried this one first but didnt work
BUILD_NUMBER=$((BUILD_NUMBER+=1)) //that one also didnt help
有什么想法吗?
答案 0 :(得分:1)
BUILD_NUMBER=$(/usr/libexec/PlistBuddy -c "Print :CFBundleVersion" <my plist path>)
echo $BUILD_NUMBER
NEWSUBVERSION=`echo $BUILD_NUMBER | awk -F "." '{print $3}'`
NEWSUBVERSION=$(($NEWSUBVERSION + 1))
NEWVERSIONSTRING=`echo $BUILD_NUMBER | awk -F "." '{print $1 "." $2 ".'$NEWSUBVERSION'" }'`
echo $NEWVERSIONSTRING
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${NEWVERSIONSTRING}" <my plist path>