[ -a file ] 如果 file 存在则为真。
[ -b file ] 如果 file 存在且是一个块特殊文件则为真。
[ -c file ] 如果 file 存在且是一个字特殊文件则为真。
[ -d file ] 如果 file 存在且是一个目录则为真。
[ -e file ] 如果 file 存在则为真。
[ -f file ] 如果 file 存在且是一个普通文件则为真。
[ -g file ] 如果 file 存在且已经设置了SGID则为真。
[ -h file ] 如果 file 存在且是一个符号连接则为真。
[ -k file ] 如果 file 存在且已经设置了粘制位则为真。
[ -p file ] 如果 file 存在且是一个名字管道(F如果O)则为真。
[ -r file ] 如果 file 存在且是可读的则为真。
[ -s file ] 如果 file 存在且大小不为0则为真。
[ -t FD ] 如果文件描述符 FD 打开且指向一个终端则为真。
[ -u file ] 如果 file 存在且设置了SUID (set user ID)则为真。
[ -w file ] 如果 file 如果 file 存在且是可写的则为真。
[ -x file ] 如果 file 存在且是可执行的则为真。
[ -O file ] 如果 file 存在且属有效用户ID则为真。
[ -G file ] 如果 file 存在且属有效用户组则为真。
[ -L file ] 如果 file 存在且是一个符号连接则为真。
[ -N file ] 如果 file 存在 and has been mod如果ied since it was last read则为真。
[ -S file ] 如果 file 存在且是一个套接字则为真。
[ file1 -nt file2 ] 如果 file1 比 file2 新,或 file1 不存但 file2 不存在则为真。
[ file1 -ot file2 ] 如果 file1 比 file2 要老, 或者 file2 存在且 file1 不存在则为真。
[ file1 -ef file2 ] 如果 file1 和 file2 指向相同的设备和节点号则为真。
[ -o OPTIONNAME ] 如果 shell选项 “OPTIONNAME” 开启则为真。
[ -z string ] “string” 的长度为零则为真。
[ -n string ] or [ string ] “string” 的长非零则为真。
[ string1 == string2 ] 如果2个字符串相同则为真。
[ string1 != string2 ] 如果字符串不相等则为真。
[ string1 < string2 ] 如果 string1 排序在 string2 之前则为真。
[ string1 > string2 ] 如果 string1 排序在 string2 之后则为真。
转载:http://blog.sina.com.cn/s/blog_76c853c201019dh7.html