#!/usr/bin/perl
mkdir "temp", 0755 or warn "Cannot make temp directory: $!";
my $name = "hello";
my $permissions = "07555";
mkdir $name, oct($permissions);
#从命令行指定目录名字和权限
my ($comname, $perm) = @ARGV;
mkdir $comname, oct($perm) or die "Cannot create $comname: $!";
# ./opdir.pl world 0755
# ls -l |grep ^d
drwxr-xr-x 2 root root 4096 2011-10-12 10:59 hello
drwxr-xr-x 2 root root 4096 2011-10-12 10:59 temp
drwxr-xr-x 2 root root 4096 2011-10-12 10:59 world
foreach my $dir (wq(temp, hello, world)) {
rmdir $dir or warn "cannot rmdir $dir: $!\n";
}
unlink |
unlink glob "hello/*
欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) | Powered by Discuz! X3.2 |