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.