Linux shell test usage

Source: Internet
Author: User


Linux shell test usage 1) determine the expression www.2cto.com if test (the expression is true) if test! Expression is false test expression 1-a expression 2 both are true test expression 1-o expression 2 two are true 2) judge the length of the test-n string. The length of the non-zero test-z string is zero. test string 1 = string 2 string is equal to test string 1! = String 2 string not equal to 3) judge integer www.2cto.com test integer 1-eq integer 2 integer equal test integer 1-ge integer 2 integer 1 greater than or equal to integer 2 test integer 1-gt integer 2 integer 1 greater than integer 2 test integer 1 -le integer 2 integer 1 less than or equal to integer 2 test integer 1-lt integer 2 integer 1 less than integer 2 test integer 1-ne integer 2 integer 1 not equal to integer 2 4) determine whether the file test File1-ef File2 has the same device number and I node number test File1-nt File2. File 1 is older than file 2's new test File1-ot File2 file 1 and file 2. the test-B File exists, and the test-c File of the block device exists, and the test-d File of the character device exists, and the test-e File of the test-e directory exists. the File exists and the test-g File is a regular File, and the test-G File with the group ID is set to exist, and the test-h File with the valid group ID exists and is a symbol. link (same as-L) the test-k File exists and the sticky bit test-B File is set to exist. The test-L File in the block device File exists and is a symbolic link (same as-h) the test-o File exists and belongs to the valid user ID www.2cto.com test-p File. It is a named pipe. The test-r File exists and can be read from the test-s File and is a socket. the test-t FD File descriptor is a test-u File opened on a terminal that exists and its set-user-id test-w File is set to exist and can be written to test-x. the File exists and can be executed.
 

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.