I've been trying to figure out how to use File::stat to check file
modes but
haven't had much luck understanding how it works from the
documentation. My
goal is to check if a file is owned by a specific user, group owned by a
specific group and has mode 660. I have the uid and gid checks dow
Abid Khwaja wrote:
> I've been trying to figure out how to use File::stat to check file
> modes but haven't had much luck understanding how it works from the
> documentation. My goal is to check if a file is owned by a specific
> user, group owned by a specific group and has mode 660. I have th
Thanks for the pointers. Here's what I did:
1. stat the file to see the mode set by the system
demerzel:~/etc abid$ ls -l
total 16
-rw-rw 1 root uucp 311 Nov 14 15:20 slist.conf
demerzel:~/etc abid$ stat -s slist.conf
st_dev=234881026 st_ino=6858828 st_mode=0100660 st_nlink=1 st_uid=0
Abid Khwaja wrote:
> Thanks for the pointers. Here's what I did:
>
> 1. stat the file to see the mode set by the system
>
> demerzel:~/etc abid$ ls -l
> total 16
> -rw-rw 1 root uucp 311 Nov 14 15:20 slist.conf
> demerzel:~/etc abid$ stat -s slist.conf
> st_dev=234881026 st_ino=6858828 s
From perldoc,
stat function returns a 13 element list
I think
my $perms = stat($conffile)
will not work as you expect.
On Saturday 26 November 2005 04:03, Abid Khwaja wrote:
> Thanks for the pointers. Here's what I did:
>
> 1. stat the file to see the mode set by the system
>
> demerzel:~/etc a
Mohammed Shameer wrote:
> From perldoc,
> stat function returns a 13 element list
> I think
> my $perms = stat($conffile)
> will not work as you expect.
Please read the documentation for the File::stat module to see why this does
indeed work.
perldoc File::stat
John
--
use Perl;
program
fulfi
On Nov 26, 2005, at 4:58 AM, John W. Krahn wrote:
You could use perl's built-in getgrnam function to do that:
$ perl -le' $shouldbegid = getgrnam "uucp"; print $shouldbegid'
14
Cool, that's much better. Thanks.
I think you may misunderstand how the & operator works. You are
telling