Go to the first, previous, next, last section, table of contents.

chown

`chown(LIST)'
`chown LIST'
uidgid を最初の引数二つで(この順で)数値で指定する。 変更するのに成功したファイルの数を返す。
$cnt = chown $uid, $gid, 'foo', 'bar';
chown $uid, $gid, @filenames;

(例: passwd ファイルから数値でない uid を検索する)
print "User: ";
$user = <STDIN>;
chop($user);
print "Files: "
$pattern = <STDIN>;
chop($pattern);
open(pass, '/etc/passwd')
     || die "Can't open passwd: $!\n";
while (<pass>) {
     ($login,$pass,$uid,$gid) = split(/:/);
     $uid{$login} = $uid;
     $gid{$login} = $gid;
}
@ary = <${pattern}>;     # ファイル名を得る
if ($uid{$user} eq ") {
     die "$user not in passwd file";
}
else {
     chown $uid{$user}, $gid{$user}, @ary;
}

Go to the first, previous, next, last section, table of contents.