Skip to content

Instantly share code, notes, and snippets.

@jamesandariese
Created November 14, 2018 23:45
Show Gist options
  • Save jamesandariese/7d7b143e5a9f764050d54ccd0c262e7f to your computer and use it in GitHub Desktop.
Save jamesandariese/7d7b143e5a9f764050d54ccd0c262e7f to your computer and use it in GitHub Desktop.
Increment minor version
# put version in VERSION file. this will increment the minor version automatically.
VERSION=`((tr '.' ' ' < VERSION ; echo 1+f) | dc;echo f) | dc | paste -s -d . -`
echo $VERSION > VERSION
@jamesandariese
Copy link
Author

Some samples of what this will do:

andariese$ echo 1.0.0 > VERSION
andariese$ cat VERSION && bash increment.sh && cat VERSION
1.0.0
1.0.1
andariese$ cat VERSION && bash increment.sh && cat VERSION
1.0.1
1.0.2
andariese$ cat VERSION && bash increment.sh && cat VERSION
1.0.2
1.0.3
andariese$ cat VERSION && bash increment.sh && cat VERSION
1.0.3
1.0.4
andariese$ cat VERSION && bash increment.sh && cat VERSION
1.0.4
1.0.5
andariese$ cat VERSION && bash increment.sh && cat VERSION
1.0.5
1.0.6
andariese$ echo 1 > VERSION
andariese$ cat VERSION && bash increment.sh && cat VERSION
1
2
andariese$ cat VERSION && bash increment.sh && cat VERSION
2
3
andariese$ cat VERSION && bash increment.sh && cat VERSION
3
4
andariese$ cat VERSION && bash increment.sh && cat VERSION
4
5
andariese$ cat VERSION && bash increment.sh && cat VERSION
5
6
andariese$ echo 1.0.999 > VERSION
andariese$ cat VERSION && bash increment.sh && cat VERSION
1.0.999
1.0.1000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment