Skip to content

Instantly share code, notes, and snippets.

@shizonic
Created July 16, 2019 14:59
Show Gist options
  • Save shizonic/e2024d04e47c57144dcb668e4115ce56 to your computer and use it in GitHub Desktop.
Save shizonic/e2024d04e47c57144dcb668e4115ce56 to your computer and use it in GitHub Desktop.
#!/bin/sh -e
#
# Get latest version of a package.
[ "$1" ] || exit 1
curl -s "https://repology.org/badge/latest-versions/$1.svg" |
while read -r line; do
case $line in
*"latest packaged version"*) v=$((v+=1)) ;;
*)
[ "$v" = 2 ] && {
line=${line#*>}
line=${line%<*}
printf '%s\n' "${line##*, }"
exit
}
;;
esac
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment