Shell (ii) operator

Source: Internet
Author: User
Tags bit set

 Numeric Operations

Need to use expr
One=' Expr5 + Ten' echo $one two points Note: there is a space between the expression and the operator, for example2+2Is wrong must be written2 + 2The complete expression is to be ' contained ' note that this character is not a common single quotation mark below the ESC key multiplication sign (*You must add a backslash (\) in front of it to enable multiplication such as: one=' Expr5\* Ten' relational operators : Relational operators support numbers only and do not support strings unless the value of the string is a number-EQ detects whether two numbers are equal and returns true for equality.[$a-eq $b]returns True-NE detects whether two numbers are equal and returns true if they are not equal.[$a-ne $b]returns True. -The GT detects if the number on the left is greater than the right, and returns true if it is.[$a-gt $b]returns false-LT detects if the number on the left is less than the right, and returns true if it is.[$a-lt $b]returns True-GE detects if the number on the left is large equal to the right, and returns true if it is.[$a-ge $b]returns false-Le detects whether the number on the left is less than or equal to the right and, if so, returns True.[$a-le $b]returns the true string operator =Detects whether two strings are equal and returns true for equality.[$a = $b]returns FALSE. !=Detects whether two strings are equal and returns true if they are not equal.[$a! = $b]returns True. -Z detects whether the string length is 0 and returns true for 0.[- Z $a]returns FALSE. -N detects whether the string length is 0 and does not return true for 0.[- Z $a]returns True. StrDetects whether the string is empty and does not return true for null.[$a]returns True. file test Operators -BfileDetects if the file is a block device file, and returns True if it is.[- b $file]returns false-CfileDetects if the file is a character device file, and returns True if it is.[- b $file]returns false-DfileDetects if the file is a directory, and returns True if it is.[- D $file]returns false-FfileDetects if the file is a normal file (neither a directory nor a device file), and returns True if it is.[- F $file]returns True-Gfiledetects if the file has a SGID bit set, and returns True if it is-KfileDetects if the file has a sticky bit set (StickyBit), and returns True if it is.[- k $file]returns false-PfileDetects if the file is a named pipe, and returns True if it is.[- P $file]returns false-UfileDetects if the file has a SUID bit set, and returns True if it is.[- u $file]returns false-RfileDetects if the file is readable and returns true if it is.[- R $file]return-WfileDetects if the file is writable and returns true if it is.[- W $file]returns True-XfileDetects if the file can be executed and, if so, returns True.[- x $file]returns True-SfileDetects whether the file is empty (the file size is greater than 0) and does not return true for null.[- s $file]returns True-EfileDetects whether the file (including the directory) exists and, if so, returns True.[- e $file]Returns True

Shell (ii) operator

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.