Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save swelljoe/909c5c31606fe7a8fa96426e5f8d77be to your computer and use it in GitHub Desktop.
Save swelljoe/909c5c31606fe7a8fa96426e5f8d77be to your computer and use it in GitHub Desktop.
# vgt $oldver $newver - version greater than test
function vgt() {
parts=(${1//./ })
major=${parts[0]}
minor=${parts[1]}
newparts=(${2//./ })
newmajor=${newparts[0]}
newminor=${newparts[1]}
if (( $major < $newmajor )); then
return 0
elif (( $major == $newmajor )) && (( $minor < $newminor )); then
return 0
else
return 1
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment