Get the App
SLTechnology News&Howtos  ›  Servers  › 

What are the test operators for the basics of shell scripts

Shulou Source: shulou.com Published: 2022-06-01 03:00:15 09月22日 Update

Editor to share with you what the basic knowledge of shell script test operators are, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

I. the size of the integer tester; note: spaces must be left on both sides of the operator

[intnum1-eq intnum2] or [[intnum1-eq intnum2]]

-eq: equal to [intnum1-ne intnum2] or [[intnum1-ne intnum2]]-ne: not equal to [intnum1-gt intnum2] or [[intnum1-gt intnum2]]-gt: greater than [intnum1-ge intnum2] or [[intnum1-ge intnum2]]-ge: greater than or equal to [intnum1-lt intnum2] or [intnum1-lt intnum2]-lt: less than [intnum1-le intnum2] or [[intnum1-le intnum2]-le: less than, etc. Spaces on both sides of ((intnum1 = = intnum2)) can omit two numbers equal to returning true ((intnum1! = intnum2)). Two numbers are not equal to returning true ((intnum1 > intnum2)). Two numbers are greater than returning true ((intnum1 > = intnum2)). Two numbers are greater than or equal to returning true ((intnum1 < intnum2)). Two numbers are less than returning true ((intnum1).

Tags: Files tests characters strings two expressions operators knowledge articles basics scripts both ends content size more directory length ordinary not so much Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi NVidia Shulou Tech Info vpn macOS