2013-02-12 55 views

回答

4

你可能想要的是-f 'myfile',如果名称对应一个文件,返回true。

a number of these tests,您可以使用-e来检查名称是否存在,但它可能是文件或目录(或者可能是Unix上的链接或管道)。

0

关于ccperl (or ratpl),请检查使用的perl版本(对于旧的ClearCase版本,它仍然是5.8.6)。
这可能会影响使用某些使用-f测试的文件,如this thread illustrates from a file with a trailing space

你可以看到ClearCase ccperl script here一个例子:

if ($n_file != 0) { 
    while ($file_name = shift(@file_list)) 
    { 
    if (! -f $vob_path.$dir_part.'/'.$file_name) { 
     print "not found $vob_path".$dir_part.'/'."$file_name \n"; 
    } else { 
     $size1 = &file_size($file_name); 
     $size2 = &file_size($vob_path.$dir_part.'/'.$file_name); 
     if ($size1 != $size2) { 
     print "Err file $dir_part $file_name $size1 $size2\n"; 
     } 
    } 
    } 
} 

(它也将测试目录,下面几行,用-d选项)