# _LAST_PATCH being something like 00.0042. It is a real
# world example and as such not everything makes sense. _MAJOR for instance
# is just dead weight.
shopt -s extglob # To get support for more sophisticated pattern
_MAJOR=${_LAST_PATCH%%.+([0-9])} # Remove longest pattern match from behind
_MINOR=${_LAST_PATCH##+([0-9]).} # Remove longest pattern match from front
_MINOR=${_MINOR##+(0)} # Remove leading 0s
_MAJOR=${_MAJOR:-0} # If nothing remains, set to 0
_MINOR=${_MINOR:-0}
shopt -u extglob
# Generate the new minor number
((_MINOR += 1)) # Increment _MINOR
_MINOR=$(printf %04d ${_MINOR}) # left padding with 0. printf is a bash internal!
Thursday, 28 March 2019
[bash] String manipulation within
In stead of turning to subprocesses with sed and the like. Works at least as of version 4.2.46(2)
Subscribe to:
Post Comments (Atom)
[git] Create a local branch from another branch
From the active branch git checkout -b <LOCAL_BRANCH> From a donator branch git checkout -b <LOCAL_BRANCH> <DONATING_BRANCH...
-
Problem A fresh install of Ubuntu does not sport the hibernate option/button. Solution not working for me Presumtion is that you use a swap ...
-
If you need to put together data from different sources, chances are high that they are not using the same coordinate system, the same proje...
-
As expample, PostgreSQL installation of version 11 with cluster main is being used. Replace postgresql@11-main accordingly. Many services...
No comments:
Post a Comment