my $Path = $_[0];
return "" if(not $Path or not -f $Path);
Run Code Online (Sandbox Code Playgroud)
我正在浏览perl文件而无法理解-f选项意味着什么不是-f意味着什么?
Bla*_*iev 11
该-f运营商测试其操作数是否是一个普通的文件,而不是一个目录,符号链接,或其他特殊文件.
所有以a开头的运算符-都称为文件测试运算符,通常也可以在shell脚本语言中找到.它们是一元运算符(仅占一个操作数),类似于!或是~一元运算符.
-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
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
686 次 |
| 最近记录: |