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: [email protected] [mailto:[email protected]] On Behalf Of 
[email protected]
Sent: Tuesday, June 25, 2019 10:34 AM
To: [email protected]; Fan, ZhijuX <[email protected]>
Cc: Gao, Liming <[email protected]>; Feng, Bob C <[email protected]>
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<http://tldp.org/LDP/abs/html/special-chars.html#ASCIIDEF> alphabetical 
order

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

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

Note that the "<" needs to be 
escaped<http://tldp.org/LDP/abs/html/escapingsection.html#ESCP> within a [ ] 
construct.



--
Rebecca Cran


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#42863): https://edk2.groups.io/g/devel/message/42863
Mute This Topic: https://groups.io/mt/32199579/21656
Group Owner: [email protected]
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to