function kernelv(){
[ -f /proc/version ] && read _1 _2 v _3 < /proc/version || return 5;
v=${v%%-*};v=${v//./ };
read v1 v2 v3 <<<$v;
v1=${v1:-0};v2=${v2:-0};v3=${v3:-0};
[ "$1" == "" ] && { echo $v1.$v2.$v3; return 4; };
_v=${1//./ };
read _v1 _v2 _v3 <<<$_v;
_v1=${_v1:-0};_v2=${_v2:-0};_v3=${_v3:-0};
[ "$_v1" -gt "$v1" ] && { echo "gt"; return 1; };
[ "$_v1" -lt "$v1" ] && { echo "lt"; return 2; };
[ "$_v2" -gt "$v2" ] && { echo "gt"; return 1; };
[ "$_v2" -lt "$v2" ] && { echo "lt"; return 2; };
[ "$_v3" -gt "$v3" ] && { echo "gt"; return 1; };
[ "$_v3" -lt "$v3" ] && { echo "lt"; return 2; };
echo "eq"; return 0;
}
沒有留言:
張貼留言