• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2
3if [ $# -ne 3 ]; then
4	echo "Usgae: ./tst_kvercmp.sh r1 r2 r3"
5	exit 1
6fi
7
8ker_ver=$(uname -r)
9r1=$(echo ${ker_ver} | awk -F. '{print $1}')
10r2=$(echo ${ker_ver} | awk -F. '{print $2}')
11r3=$(echo ${ker_ver} | awk -F. '{print $3}')
12r3=${r3%%-*}
13
14test_ver=$(($1 * 65536 + $2 * 256 + $3))
15curr_ver=$((${r1} * 65536 + ${r2} * 256 + ${r3}))
16if [ ${curr_ver} -ge ${test_ver} ]; then
17	echo 0
18else
19	echo 1
20fi
21