码迷,mamicode.com
首页 > 系统相关 > 详细

Linux Shell Test

时间:2015-04-07 20:06:44      阅读:175      评论:0      收藏:0      [点我收藏+]

标签:linux   字符串   false   equivalent   

( EXPRESSION )

EXPRESSION is true          EXPRESSION为真


! EXPRESSION

EXPRESSION is false        EXPRESSION为假


EXPRESSION1 -a EXPRESSION2

both EXPRESSION1 and EXPRESSION2 are true      两者都为真


EXPRESSION1 -o EXPRESSION2

either EXPRESSION1 or EXPRESSION2 is true      其中一个为真


-n STRING

the length of STRING is nonzero                字符串长度非0


STRING equivalent to -n STRING


-z STRING

the length of STRING is zero                  字符串长度为0


STRING1 = STRING2

the strings are equal                       字符串相等


STRING1 != STRING2

the strings are not equal                    字符串不相等


INTEGER1 -eq INTEGER2

INTEGER1 is equal to INTEGER2                 INTEGER1等于INTEGER2


INTEGER1 -ge INTEGER2

INTEGER1 is greater than or equal to INTEGER2      INTEGER1大于等于INTEGER2


INTEGER1 -gt INTEGER2

INTEGER1 is greater than INTEGER2              INTEGER1大于INTEGER2


INTEGER1 -le INTEGER2

INTEGER1 is less than or equal to INTEGER2        INTEGER1小于等于INTEGER2


INTEGER1 -lt INTEGER2

INTEGER1 is less than INTEGER2            INTEGER1小于INTEGER2


INTEGER1 -ne INTEGER2

INTEGER1 is not equal to INTEGER2              INTEGER1不等于INTEGER2


FILE1 -ef FILE2

FILE1 and FILE2 have the same device and inode numbers


FILE1 -nt FILE2

FILE1 is newer (modification date) than FILE2


FILE1 -ot FILE2

FILE1 is older than FILE2


-b FILE

FILE exists and is block special               文件存在且为块特殊文件


-c FILE

FILE exists and is character special            文件存在且为字符特殊文件


-d FILE

FILE exists and is a directory                文件存在且为目录


-e FILE

FILE exists                            文件存在


-f FILE

FILE exists and is a regular file              文件存在且为正规文件


-g FILE

FILE exists and is set-group-ID               文件存在且已设置组ID


-G FILE

FILE exists and is owned by the effective group ID  文件存在且属组为有效的组ID


-h FILE

FILE exists and is a symbolic link (same as -L)    文件存在且为符号链接


-k FILE

FILE exists and has its sticky bit set          文件存在且已设置sticky-bit权限


-L FILE

FILE exists and is a symbolic link (same as -h)    文件存在且为符号链接


-O FILE

FILE exists and is owned by the effective user   ID文件存在且属主为有效的用户ID


-p FILE

FILE exists and is a named pipe


-r FILE

FILE exists and read permission is granted      文件存在且可读


-s FILE

FILE exists and has a size greater than zero     文件存在且大小非0


-S FILE

FILE exists and is a socket            文件存在且是socket文件


-t FD  file descriptor FD is opened on a terminal


-u FILE

FILE exists and its set-user-ID bit is set   文件存在且已设置set-user-id bit权限


-w FILE

FILE exists and write permission is granted            文件存在且可写


-x FILE

FILE exists and execute (or search) permission is granted   文件存在且可执行


Linux Shell Test

标签:linux   字符串   false   equivalent   

原文地址:http://lhstruggle.blog.51cto.com/7012737/1629606

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!