Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 4.3 Shell Script synthax error on autoincrement script

I have this script made to autoincrement the build number on every build:

#!/bin/bash
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" $INFOPLIST_FILE)
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" $INFOPLIST_FILE

I inserted it on the build phases before the "copy bundle resources". I get an error saying:

Command /bin/sh failed with exit code 1 /Users/ricardodelfingarcia/Library/Developer/Xcode/DerivedData/Flat_Wars-bhkfhubvxegpazcnqcswodoejxeo/Build/Intermediates/Flat Wars.build/Debug-iphoneos/Flat Wars.build/Script-B6B328B815AA6F9900C26C37.sh: line 4: File Doesn't Exist, Will Create: Flat Invalid Arguments + 1.0: syntax error: invalid arithmetic operator (error token is "'t Exist, Will Create: Flat Invalid Arguments + 1.0") Parse Error: Unclosed Quotes Value Required for Set Command

What is the problem?

like image 287
rdelfin Avatar asked Oct 17 '25 14:10

rdelfin


1 Answers

Problem is you have space in your directory name.

This will work:

#!/bin/bash
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE")
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$INFOPLIST_FILE"
like image 163
Matej Avatar answered Oct 20 '25 17:10

Matej



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!