Skip to content

Instantly share code, notes, and snippets.

@bitmvr
Created April 4, 2019 15:20
Show Gist options
  • Select an option

  • Save bitmvr/6328e4d10e6cf5ed1d1ae267ecd694e8 to your computer and use it in GitHub Desktop.

Select an option

Save bitmvr/6328e4d10e6cf5ed1d1ae267ecd694e8 to your computer and use it in GitHub Desktop.
Parse SEMVER in Bash
#!/usr/bin/env bash
SEMANTIC_VERSION='1.2.3'
SEMVER_ARRAY=(${SEMANTIC_VERSION//./ })
echo "MAJOR: ${SEMVER_ARRAY[0]}"
echo "MINOR: ${SEMVER_ARRAY[1]}"
echo "PATCH: ${SEMVER_ARRAY[2]}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment