Bash script to retrieve Ubuntu codenames and versions

I’m working a script to automatically backport Debian packages to Ubuntu. I needed a way to get a list of currently supported/active Ubuntu releases by codename or version. Here is how I do it.

Get a list of Ubuntu codenames

wget -q -O - | sed -e :a -e 's/<[^>]*>//g;/</N;//ba' | grep '^[[:space:]][a-z]' | sed 's/\///g'

Get a list of Ubuntu versions

wget -q -O - | sed -e :a -e 's/<[^>]*>//g;/</N;//ba' | grep '^[[:space:]][1-9]' | sed 's/\///g'


Comments powered by Disqus
Flattr this