#!/bin/bash function checkVersion() { V1=$1 V2=$2 MAJ1=$(echo $V1 | cut -d. -f1) MIN1=$(echo $V1 | cut -d. -f2) REV1=$(echo $V1 | cut -d. -f3) MAJ2=$(echo $V2 | cut -d. -f1) MIN2=$(echo $V2 | cut -d. -f2) REV2=$(echo $V2 | cut -d. -f3) if [[ $MAJ1 -lt $MAJ2 ]] ; then return 1; fi if [[ $MAJ1 -eq $MAJ2 ]] ; then if [[ -n "$MIN2" ]] ; then if [[ -n "$MIN1" ]] ; then if [[ $MIN1 -lt $MIN2 ]] ; then return 1; fi if [[ $MIN1 -eq $MIN2 ]] ; then if [[ -n "$REV2" ]] ; then if [[ -n "$REV1" ]] ; then if [[ $REV1 -lt $REV2 ]] ; then return 1; fi else return 1; fi fi fi else return 1; fi fi fi return 0; } # Check Thunderbird TB=$(curl -s https://ftp.mozilla.org/pub/thunderbird/releases/ | sed -n "s/^\s\+<td><a href=\".*\">\(.*\)\/<\/a><\/td>$/\1/gp" | sort -g | grep -v b | tail -n 1 ) TBL=$(thunderbird -v | sed -n "s/^\s*Thunderbird\s*\(.*\)$/\1/gp") checkVersion $TBL $TB if [[ $? -eq 1 ]] ; then echo "Update Thunderbird ($TBL -> $TB)" fi # Check Firefox TB=$(curl -s https://ftp.mozilla.org/pub/firefox/releases/ | sed -n "s/^\s\+<td><a href=\".*\">\(.*\)\/<\/a><\/td>$/\1/gp" | sort -g | grep -v b | tail -n 1 ) TBL=$(firefox -v | sed -n "s/^.*Firefox\s*\(.*\)$/\1/gp") checkVersion $TBL $TB if [[ $? -eq 1 ]] ; then echo "Update Firefox ($TBL -> $TB)" fi