# ls -l *.txt
-rw-r--r-- 1 root root 0 Oct 12 13:29 test1.txt
-rw-r--r-- 1 root root 0 Oct 12 13:29 test2.txt
-rw-r--r-- 1 root root 0 Oct 12 13:29 test3.txt
-rw-r--r-- 1 root root 0 Oct 12 13:29 test4.txt
-rw-r--r-- 1 root root 0 Oct 12 13:29 test5.txt
#!/usr/bin/perl
my $user = 500;
my $group = 500;
chown $user, $group, glob "*.txt";
ls -l *.txt
-rw-r--r-- 1 beyes beyes 0 Oct 12 13:29 test1.txt
-rw-r--r-- 1 beyes beyes 0 Oct 12 13:29 test2.txt
-rw-r--r-- 1 beyes beyes 0 Oct 12 13:29 test3.txt
-rw-r--r-- 1 beyes beyes 0 Oct 12 13:29 test4.txt
-rw-r--r-- 1 beyes beyes 0 Oct 12 13:29 test5.txt
#!/usr/bin/perl
defined (my $user = getpwnam "beyes") or die "bad user";
defined (my $group = getgrnam "beyes") or die "bad group";
chown $user, $group, glob "*.txt";
欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) | Powered by Discuz! X3.2 |