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 (#42775): https://edk2.groups.io/g/devel/message/42775 Mute This Topic: https://groups.io/mt/32199579/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-