I am trying to run a Run Script Phase in Xcode 11.4 to auto increment my build number.
#!/bin/bash
bN=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE")
bN=$((bN += 1))
bN=$(printf "%d" $bN)
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $bN" "$INFOPLIST_FILE"
When I build my project I get the following error:
/Users/Me/Library/Developer/Xcode/DerivedData/MyApp-dmbnskuxjhlbmpeciklnrsercgqx/Build/Intermediates.noindex/MyApp.build/Debug-iphonesimulator/MyApp.build/Script-E4D01FDD243BC0E2007311D3.sh: line 5: $(CURRENT_PROJECT_VERSION): syntax error: operand expected (error token is "$(CURRENT_PROJECT_VERSION)") Command PhaseScriptExecution failed with a nonzero exit code