Skip to Content.
Sympa Menu

sm-discuss - Re: [SM-Discuss] grimoire function to check minimum kernel ver

sm-discuss AT lists.ibiblio.org

Subject: Public SourceMage Discussion List

List archive

Chronological Thread  
  • From: Juuso Alasuutari <iuso AT sourcemage.org>
  • To: sm-discuss AT lists.ibiblio.org
  • Subject: Re: [SM-Discuss] grimoire function to check minimum kernel ver
  • Date: Tue, 4 Apr 2006 21:25:48 +0300

On Tuesday 04 April 2006 21:19, Jaka Kranjc wrote:
> > Alright. What difference do `` and $() have all in all?
> >
> > Juuso
>
> Not many, most of the times it shouldn't make any difference.
> $() allows for easier nesting - you don't need to escape the other
> substitutions. $() is easier to read.

OK. Thanks to you and Andrew for clarifying this, I'll use $() from now on.
Here's a rewritten version. I managed to slim it down a bit, now it uses an
array instead of counting words with wc.

function is_kernel_minimum() {
local MIN CUR a n=0
MIN=$(expr $1 : '\(^[^-]*\)')
MIN=${MIN//\./\ }
CUR=$(expr $(get_kernel_version) : '\(^[^-]*\)')
CUR=(${CUR//\./\ })
for a in $MIN; do
if (( a < ${CUR[n]=0} )); then
return 0
elif (( a > ${CUR[n]=0} )); then
return 1
fi
(( n += 1 ))
done
}

Juuso




Archive powered by MHonArc 2.6.24.

Top of Page