总结了下shell常用的test控制项:
string1 = string2
string1 != string2
-n string1 //string1 is not null
-z string1 //string1 is null
int1 -eq int2 //int1 is equal to int2
int1 -ge int2 //int1 is great than int2 or equal to int2
int1 -gt int2 //int1 is great than int2
int1 -le int2 //int1 is less than int2 or equal to int2
int1 -lt int2 //int1 is less than int2
int1 -ne int2 //int1 is not equal to int2
-d file1 //file1 is a directory
-e file1 //file1 is exist
-f file1 //file1 is an ordinary file
-L file1 //file1 is a Symbolic Link
-r file1 //file1 is an readable file
-w file1 //file1 is an writeable file
-x file1 //file1 is an executable file
-s file1 //file1 has nonzero length
-f file1 -a -f file2 //file1 is exist and file2 is exist
-f file1 -o -f file2 //file1 is exist or file2 is exist
who //view the user who is logged on
on guicl //check the user guicl is logged on