2012-02-16 65 views

回答

11

-f运算符测试其操作数是否是常规文件,而不是目录,符号链接或其他特殊文件。

所有以-开头的运算符都称为文件测试运算符,并且通常也以shell脚本语言存在。它们是一元运算符(只需一个操作数),如!~是一元运算符。

+2

[有关文件操作符的详细信息,请参见这里。](http://perldoc.perl.org/functions/-X.html) – Feysal 2012-02-16 08:48:21

8
-r readable 
-w writable 
-x executable 
-o owned by user 
-R readable by this user or group 
-W writable by user or group 
-X executable by this user or group 
-O owned by this user 
-e File or directory name exists 
-z File exists and has zero size 
-s exists and has nonzero size (the value is the size in bytes) 
-f plain file 
-d directory 
-l symbolic link 
-S socket 
+0

非常感谢... – 2012-02-16 09:01:48