Reputation: 265
I have a script. I made it for automatically build iOS code uploadable for iTunes Connect on a Mac Mini. My problem is, that I have to change the CFBundleShortVersionString, to hide our internal versioning. it is also important, because iTunes Connect warns me that the version is not valid!
#!/bin/bash
cat info.plist | grep -A1 "CFBundleShortVersionString" | sed "s/\(<string>\).*\(<\/string>\)/\1%CFBUNDLESHORTVERSION%\2/g" > info.plist_in.bk
cat info.plist_in.bk
cat info.plist | grep -A1 "CFBundleShortVersionString" | grep -v CFBundleShortVersionString | egrep "[A-z0-9]+" > delete.txt
cat delete.txt
cat info.plist | grep -v "CFBundleShortVersionString" > infoi.plist_in
cat infoi.plist_in
touch info.plist_in
cat infoi.plist_in | grep -v $(cat delete.txt) > info.plist_in
cat info.plist_in.bk >> info.plist_in
sed -i .bk2 -e "s/<\/dict>//g" info.plist_in
sed -i .bk3 -e "s/<\/plist>//g" info.plist_in
echo "</dict>" >> info.plist_in
echo "</plist>" >> info.plist_in
cat info.plist_in > info.plist
My problem is, that I get back the next error:
cat: infoi.plist_in: No such file or directory
cat: delete.txt: No such file or directory
usage: grep [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
[-e pattern] [-f file] [--binary-files=value] [--color=when]
[--context[=num]] [--directories=action] [--label] [--line-buffered]
[--null] [pattern] [file ...]
cat: info.plist_in.bk: No such file or directory
sed: info.plist_in: No such file or directory
cat: info.plist_in: No such file or directory
Any ideas?
Edit: The xcrun agvtool command don't resolved the problem, this is the cause why I write my own script Each command is syntactically correct, when I run them distinctly, the code do what I want.
Upvotes: 2
Views: 191
Reputation: 9721
Use PlistBuddy
(manpage) to write the version string instead:
$ /usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString YourVersion" file.plist
If you want to auto-increment the build number in the plist
(a good idea) then see this SO answer.
Upvotes: 2