Operator differences for Shell numeric and string comparisons

Source: Internet
Author: User

Numerical comparison:

N1-eq n2 Check if N1 equals N2 n1-le n2 check N1 is less than or equal to N2

N1-ge n2 Check if N1 is greater than or equal to N2 n1-lt n2 check N1 is less than N2

N1-GT n2 Check if N1 is greater than N2 N1-ne N2 check N1 is not equal to N2



string comparison:

STR1 = str2 Check if str1 and str2 are the same str1 > str2 check if STR1 is greater than str2

Str1! = str2 Check if str1 and str2 are different-n str1 check if the length of the str1 is greater than 0

STR1 < str2 check if STR1 is less than str2-z str1 check if the length of the str1 is 0








This article is from the "Cold River Exclusive Fishing" blog, please be sure to keep this source http://iter2012.blog.51cto.com/6873825/1613694

Operator differences for Shell numeric and string comparisons

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.