#!/usr/bin/env bash version="0.1" function usage () { echo "Usage : $0 [options] Options: -h,--help Display this message -v,--version Display script version" } # Parse arguments declare -a args while [[ $# -gt 0 ]]; do opt="$1" case $opt in -h|--help) usage; exit 0 ;; -v|--version) echo "$0 -- Version $version"; exit 0 ;; -q|--quiet) quiet=1 ; shift ;; -* ) echo -e "\n Option does not exist : $opt\n" usage; exit 1 ;; *) args+=("$opt"); shift ;; esac done running=$(uname -r | sed s/-/./) install=$(pacman -Q linux | cut -d' ' -f2) vcmp=$(vercmp $running $install) ((${quiet:=0}==1)) && exit $vcmp (($vcmp<0)) && echo "$running older than $install" (($vcmp>0)) && echo "$running newer than $install" exit $vcmp