Skip to content

Instantly share code, notes, and snippets.

@NickMoignard
Created February 20, 2026 01:28
Show Gist options
  • Select an option

  • Save NickMoignard/a27d2711385ccbc49231d8d533313d50 to your computer and use it in GitHub Desktop.

Select an option

Save NickMoignard/a27d2711385ccbc49231d8d533313d50 to your computer and use it in GitHub Desktop.
#!/bin/bash
semver_gt() {
awk -v v1="$1" -v v2="$2" 'BEGIN {
split(v1, a, "."); split(v2, b, ".");
for (i=1; i<=3; i++) {
if (a[i]+0 > b[i]+0) { print "true"; exit }
if (a[i]+0 < b[i]+0) { print "false"; exit }
}
print "false"
}'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment