Skip to content

Instantly share code, notes, and snippets.

@Tomin1
Last active August 29, 2015 14:14
Show Gist options
  • Select an option

  • Save Tomin1/1c7cb530413a56959508 to your computer and use it in GitHub Desktop.

Select an option

Save Tomin1/1c7cb530413a56959508 to your computer and use it in GitHub Desktop.
kernels.sh
#!/bin/sh
# This script is made by Tomi Leppänen aka Tomin (http://tomin.dy.fi/)
# You are free to use, copy, redistribute and modify this script
# as long as you accept that ***I won't take any responsibility
# for this code and it comes without any warranty***
# This script downloads Kernel.org webpage and prints out a table
# of latest Linux releases
KERNEL_ORG=www.kernel.org
kernels=$(wget -O - $KERNEL_ORG 2> /dev/null |\
grep -A 2 -E '(mainline|stable|longterm|linux-next):' |\
sed -re 's%</?\w+>%%g' -e 's/[ \t]//g' \
-e 's/<spanclass="eolkernel"title="ThisreleaseisEnd-of-Life">/ /' |\
tr '\n' '\t' |\
sed -re 's/\t*--\t*/\n/g' )
echo -e "\033[1mtree\tversion\trelease date\033[0m\n$kernels" |\
awk -F "\t" '{ printf("%-12s\t%-8s\t%-10s\n", $1, $2, $3) }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment