Chandrakant Reddy wrote:
Hi

Hello,

I wrote this script but don't know how to get the owner of that directory !!

#!/usr/bin/perl use strict ;
use warnings ;


while ( my $line = <STDIN> ) {
my @array = split(":",$line) ;


my $loginid = $array[0] ; my $uid = $array[2];
my $guid = $array[3];
my $dir = $array[5];

You don't really need @array, you can assign to the scalars directly.

    my ( $loginid, $uid, $guid, $dir ) = ( split /:/, $line )[ 0, 2, 3, 5 ];


print "$loginid:$dir\n" ; if ( -d $dir ) {
print "$dir exists !! \n";
}
else {
print "$dir does not exists !! \n";
}

if ( $uid == ( stat $dir )[ 4 ] ) { print "$dir is owned by $loginid.\n"; }

    if ( -d _ ) {
        print "$dir exists !!\n";
        }
    else {
        print "$dir does not exists !!\n";
        }


} # end of while



John -- use Perl; program fulfillment

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to