亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊(cè) 查看新帖 |

Chinaunix

  平臺(tái) 論壇 博客 文庫(kù)
最近訪問板塊 發(fā)新帖
查看: 2355 | 回復(fù): 7
打印 上一主題 下一主題

if (-d _) {............} 這個(gè)是什么意思,我打印了很多遍都找不到結(jié)果(謝謝) [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報(bào)告]
發(fā)表于 2010-08-15 02:04 |只看該作者 |倒序?yàn)g覽
if (-d _) {............}

論壇徽章:
0
2 [報(bào)告]
發(fā)表于 2010-08-15 02:06 |只看該作者
if (-d $_) 吧

論壇徽章:
0
3 [報(bào)告]
發(fā)表于 2010-08-15 02:20 |只看該作者
#!/usr/bin/perl -w
# symirror - build spectral forest of symlinks
use strict;
use File::Find;
use Cwd;

my ($srcdir, $dstdir);
my $cwd = getcwd();
die "usage: $0 realdir mirrordir" unless @ARGV == 2;

for (($srcdir, $dstdir) = @ARGV) {
    my $is_dir = -d;
    next if $is_dir;                        # cool
    if (defined ($is_dir)) {
        die "$0: $_ is not a directory\n";
    } else {                                # be forgiving
        mkdir($dstdir, 07777) or die "can't mkdir $dstdir: $!";
    }
} continue {
    s#^(?!/)#$cwd/#;                        # fix relative paths
}
                    
chdir $srcdir;
find(\&wanted, '.');

sub wanted {
    my($dev, $ino, $mode) = lstat($_);
    my $name = $File::Find::name;
    $mode &= 07777;                 # preserve directory permissions
    $name =~ s!^\./!!;              # correct name
    if (-d _) {                     # then make a real directory
        mkdir("$dstdir/andy$name", $mode)
            or die "can't mkdir $dstdir/$name: $!";
    } else {                        # shadow everything else
        symlink("$srcdir/$name", "$dstdir/$name")
            or die "can't symlink $srcdir/$name to $dstdir/$name: $!";
    }

論壇徽章:
0
4 [報(bào)告]
發(fā)表于 2010-08-15 02:20 |只看該作者
[img]#!/usr/bin/perl -w
# symirror - build spectral forest of symlinks
use strict;
use File::Find;
use Cwd;

my ($srcdir, $dstdir);
my $cwd = getcwd();
die "usage: $0 realdir mirrordir" unless @ARGV == 2;

for (($srcdir, $dstdir) = @ARGV) {
    my $is_dir = -d;
    next if $is_dir;                        # cool
    if (defined ($is_dir)) {
        die "$0: $_ is not a directory\n";
    } else {                                # be forgiving
        mkdir($dstdir, 07777) or die "can't mkdir $dstdir: $!";
    }
} continue {
    s#^(?!/)#$cwd/#;                        # fix relative paths
}
                    
chdir $srcdir;
find(\&wanted, '.');

sub wanted {
    my($dev, $ino, $mode) = lstat($_);
    my $name = $File::Find::name;
    $mode &= 07777;                 # preserve directory permissions
    $name =~ s!^\./!!;              # correct name
    if (-d _) {                     # then make a real directory
        mkdir("$dstdir/andy$name", $mode)
            or die "can't mkdir $dstdir/$name: $!";
    } else {                        # shadow everything else
        symlink("$srcdir/$name", "$dstdir/$name")
            or die "can't symlink $srcdir/$name to $dstdir/$name: $!";
    }
}[/img]

論壇徽章:
0
5 [報(bào)告]
發(fā)表于 2010-08-15 02:21 |只看該作者
  1. #!/usr/bin/perl -w
  2. # symirror - build spectral forest of symlinks
  3. use strict;
  4. use File::Find;
  5. use Cwd;

  6. my ($srcdir, $dstdir);
  7. my $cwd = getcwd();
  8. die "usage: $0 realdir mirrordir" unless @ARGV == 2;

  9. for (($srcdir, $dstdir) = @ARGV) {
  10.     my $is_dir = -d;
  11.     next if $is_dir;                        # cool
  12.     if (defined ($is_dir)) {
  13.         die "$0: $_ is not a directory\n";
  14.     } else {                                # be forgiving
  15.         mkdir($dstdir, 07777) or die "can't mkdir $dstdir: $!";
  16.     }
  17. } continue {
  18.     s#^(?!/)#$cwd/#;                        # fix relative paths
  19. }
  20.                     
  21. chdir $srcdir;
  22. find(\&wanted, '.');

  23. sub wanted {
  24.     my($dev, $ino, $mode) = lstat($_);
  25.     my $name = $File::Find::name;
  26.     $mode &= 07777;                 # preserve directory permissions
  27.     $name =~ s!^\./!!;              # correct name
  28.     if (-d _) {                     # then make a real directory
  29.         mkdir("$dstdir/andy$name", $mode)
  30.             or die "can't mkdir $dstdir/$name: $!";
  31.     } else {                        # shadow everything else
  32.         symlink("$srcdir/$name", "$dstdir/$name")
  33.             or die "can't symlink $srcdir/$name to $dstdir/$name: $!";
  34.     }
  35. }
復(fù)制代碼

論壇徽章:
0
6 [報(bào)告]
發(fā)表于 2010-08-15 02:31 |只看該作者
小駱駝上有寫。。

論壇徽章:
0
7 [報(bào)告]
發(fā)表于 2010-08-15 06:32 |只看該作者
if (-d _) {............}
whitecell 發(fā)表于 2010-08-15 02:04



    對(duì)前一次訪問的句柄的快速優(yōu)化訪問,可稍許提高性能。

$ perl -le 'open HD,"/etc/resolv.conf"; print 1 if -f HD; print 0 unless -d _'
1
0

論壇徽章:
0
8 [報(bào)告]
發(fā)表于 2010-08-15 07:43 |只看該作者
來(lái)自 perldoc 的一段解釋:
      If any of the file tests (or either the "stat" or "lstat"
      operators) are given the special filehandle consisting of a
      solitary underline, then the stat structure of the previous file
      test (or stat operator) is used, saving a system call. (This
      doesn't work with "-t", and you need to remember that lstat()
      and "-l" will leave values in the stat structure for the
      symbolic link, not the real file.) (Also, if the stat buffer was
      filled by an "lstat" call, "-T" and "-B" will reset it with the
      results of "stat _"). Example:

          print "Can do.\n" if -r $a || -w _ || -x _;

          stat($filename);
          print "Readable\n" if -r _;
          print "Writable\n" if -w _;
          print "Executable\n" if -x _;
          print "Setuid\n" if -u _;
          print "Setgid\n" if -g _;
          print "Sticky\n" if -k _;
          print "Text\n" if -T _;
          print "Binary\n" if -B _;
您需要登錄后才可以回帖 登錄 | 注冊(cè)

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號(hào)-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號(hào):11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報(bào)專區(qū)
中國(guó)互聯(lián)網(wǎng)協(xié)會(huì)會(huì)員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請(qǐng)注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP