Hi:

Python3.6 and python3.7

After the code removes some common values “python”, we compare “3.6” and “3.7”

origin_version = “3.6”, python_version=”3.7”

 

I'm going to change it to

if [[ "$origin_version" < "$python_version" ]]; then

 

 

 

 

Any question, please let me know. Thanks.

 

Best Regards

Fan Zhiju

 

 

 

From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of rebecca@bluestop.org
Sent: Tuesday, June 25, 2019 10:34 AM
To: devel@edk2.groups.io; Fan, ZhijuX <zhijux.fan@intel.com>
Cc: Gao, Liming <liming.gao@intel.com>; Feng, Bob C <bob.c.feng@intel.com>
Subject: Re: FW: [edk2-devel] [PATCH] BaseTools:Linux changes the way the latest version is judged

 

On 2019-06-24 20:18, Fan, ZhijuX wrote:

Using "-lt" will report the following errors, but "\<" will not
3.6: integer expression expected
3.7: integer expression expected
 
if [[ "$origin_version" < "$python_version" ]];then
It is equivalent to
if [ "$origin_version" \< "$python_version" ];then
These two approaches work
 
Any question, please let me know. Thanks.

 

You might want to extract the major and minor values and compare them separately then. The "<" operator in bash does a string comparison, which I'm not sure is what's wanted here?

 

From http://tldp.org/LDP/abs/html/comparison-ops.html :

 

< 

is less than, in ASCII alphabetical order

if [[ "$a" < "$b" ]]

if [ "$a" \< "$b" ]

Note that the "<" needs to be escaped within a [ ] construct.

 

--
Rebecca Cran