[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: kernel question



*- On  6 Jan, Pollywog wrote about "Re: kernel question"
>> 
>> Basically anything with a letter will be fine, something like
>> pollywog.1.  Use dpkg to check it if you are not sure.
>> 
>>#dpkg --compare-versions 2.2.14-1 ge pollywog.1 ; echo $? 
>> 1
>>#dpkg --compare-versions 2.2.14-1 lt pollywog.1 ; echo $? 
>> 0
> 
> I did not know about dpkg --compare-versions.  I am guessing the resulting "1"
> and "0" are exit codes, the "0" indicating no error.
> 

Yep.  After a command exits the shell stores the exit code in the $?
variable, and I am just echoing to see what it is.  An exit code of "0"
means no problems and anything else indicates and error.  In the first
example above dpkg returned with an error because 2.2.14-1 is NOT
"(g)reater-than-or-(e)qual-to" pollywog.1. Since 2.2.14-1 is
"(l)ess-(t)han" pollywog.1 it returned without an error code in the
second example.  The --compare-versions I think was originally ment to
be used in package scripts but it can be handy for things like this.

Brian Servis
-- 
------------------------------------------------------------------------
Mechanical Engineering              |  Never criticize anybody until you  
Purdue University                   |  have walked a mile in their shoes,
servis@purdue.edu                   |  because by that time you will be a
http://www.ecn.purdue.edu/~servis   |  mile away and have their shoes.


Reply to: