I have a server where I upload sometimes the new version of my software.
For each upload, I have to incremente the build var contained in a file.ver, like #BUILD 345.
Well, I cannot do this everytime manually, but I prefer a smart and fast solution, that increment the number of the version for each upload.
What’s the easiest way?
There is in bash a nice command to do that?
Or a callback method written in C/C++?
You can use the command
sedto replace strings in a file.For example, if you have a file
myfilewith the following content:You can use the following command to replace the version number:
The
-imeans inline, i.e. modify the file content.Result:
If you use Ant, this could be useful:
Use ANT to update build number and inject into source code
See also the following question related to version numbering (schemes):
Bumping version numbers for new releases in associated files (documentation)