Transfer from http://blog.chinaunix.net/uid-21961753-id-1810588.html
format: Test conditionstest-n string:string not empty
test-z string:string is empty
Test Int1-eq int2:int1 = = int 2
Test Int1-ne int2:int1! = Int2
test int1-gt int2:int1 > Int2
test Int1-ge int2:int1 >= int2
Test Int1-lt int2:int1 < Int2
test Int1-le int2:int1 <= int2test-r FileName: User has Read permission to file filename
test-w FileName: User has write permission to file filename
test-x FileName: User has executable permissions on file filename
test-f FileName: file filename is a normal file
test-d FileName: file filename for directory
test-c FileName: file filename is a character device file
test-b FileName: file filename is a block device file
test-s FileName: file filename size is not zero
test-t Fnumb: The device associated with the file descriptor Fnumb (default = 1) is a terminal equipmentTest!-S empty:empty is emptytest-a: and
Test-o: OrNote that the test command and the [] brackets function the same:
Linux shell:test Command parameter resolution