mode Q on File::stat

2005-11-24 Thread Abid Khwaja
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

Re: mode Q on File::stat

2005-11-24 Thread John W. Krahn
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

Re: mode Q on File::stat

2005-11-25 Thread Abid Khwaja
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

Re: mode Q on File::stat

2005-11-26 Thread John W. Krahn
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

Re: mode Q on File::stat

2005-11-26 Thread Mohammed Shameer
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

Re: mode Q on File::stat

2005-11-26 Thread John W. Krahn
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

Re: mode Q on File::stat

2005-11-28 Thread Abid Khwaja
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