Chinaunix

标题: 新手求助:关于if中使用的-M参数,知道的帮助一下 [打印本页]

作者: qq27898    时间: 2013-09-16 13:55
标题: 新手求助:关于if中使用的-M参数,知道的帮助一下
if ($origin ne "addfdjkklj" or  (-M $full_path < 180) )

请问-M参数是什么作用的?
作者: qq27898    时间: 2013-09-16 14:00
不好意思刚刚找到答案了,嘿嘿,不知道理解对不对:

-M是文件测试操作符,得到距离上次修改多长时间
作者: jason680    时间: 2013-09-16 14:42
回复 1# qq27898

$ perldoc -f -X

       -X FILEHANDLE
       -X EXPR
       -X      A file test, where X is one of the letters listed below.  This unary
               operator takes one argument, either a filename or a filehandle, and
               tests the associated file to see if something is true about it.  If
               the argument is omitted, tests $_, except for "-t", which tests STDIN.
               Unless otherwise documented, it returns 1 for true and ’’ for false,
               or the undefined value if the file doesn’t exist.  Despite the funny
               names, precedence is the same as any other named unary operator, and
               the argument may be parenthesized like any other unary operator.  The
               operator may be any of:

                   -r  File is readable by effective uid/gid.
                   -w  File is writable by effective uid/gid.
                   -x  File is executable by effective uid/gid.
                   -o  File is owned by effective uid.
                   ....

                   -M  Script start time minus file modification time, in days.

                   ....


作者: qq27898    时间: 2013-09-16 14:43
回复 3# jason680


    给力呀,我这里没有UNIX环境,平时都没法上机实验。。。。

多谢了




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2