Created
June 11, 2018 08:09
-
-
Save blndev/ea551b4551a50e0359336e6e725922b1 to your computer and use it in GitHub Desktop.
Pure BASH based Version extractor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#could be injected by ci pipeline or extracted from git | |
tag=RELEASE#1.0.7-alpha | |
#Split by "#" to get Version substring | |
tagversion=( ${tag//#/ } ) | |
product_version="${tagversion[1]}" | |
echo "${product_version}" | |
#Split by "." | |
semver=( ${product_version//./ } ) | |
major="${semver[0]}" | |
minor="${semver[1]}" | |
patch="${semver[2]}" | |
#Results | |
echo "${major}" | |
echo "${minor}" | |
echo "${patch}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment