Shell Test Statements

Source: Internet
Author: User
Test statement format: [conditional expression] Subdivision Test statements are: File test, logic test, integer value comparison, String comparison------------------------------------------------------------------------------------file test: [operator file or directory name]- D test whether the directory-e test file or directory is operating-F to determine whether the current user has permission to read-W test whether the present user has permission to write to-X tests whether the current user has permission to execute the [-d/etc/fstab] test for the directory echo $? View return value 0 Proof of the previous command success Logic test: [expression 1] operator [expression 2]&& logical with, "and" meaning on an expression executed after successful execution | | Logical OR, "or" means the execution of an expression fails after execution! logical no [-d/etc/fstab] && echo yes | | Echo no test is a catalog-enhanced integer value comparison: [Integer 1 operator integer 2]-EQ determines whether the-ne judgment is not equal to whether the-GT judgment is greater than the-LT judgment is greater than the-le judgment whether it is equal to or less than the-ge judgment is greater than or equal to the string comparison: [string 1 operator character String 2]= Compare string content is the same! = Compare string contents Whether or not the string contents are blank

  

Shell Test Statements

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.