Created
July 16, 2019 14:59
-
-
Save shizonic/e2024d04e47c57144dcb668e4115ce56 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/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