I've just finished the first working version of a more complex bash script, and I'm wrapping my head around on how to maintain the scripts version.
Why do I need this? Following GNU Coding Standards For Commandline Interfaces I've added a version option which among a license and copyright header shows the current version.
Still, I don't know how to keep the version 'up-to-date'.
My idea so far is to use git tags for major | minor | patch releases, and somehow replace a variable contained in the script.
So, if I have a tag named 1.1.0, then
$ myscript --version
Should output something like:
myscript 1.1.0
The script contains a shell variable for this:
version=1.1.0
Still, I don't now how to keep the version in sync with the latest tag?