Hi folks,
I need to convert the following Perl script into a shell script. Any help is appreciated.
#!/usr/bin/perl
use strict;
my $File = "/etc/passwd";
open (FILE,"$File" || die "error: can't open $File: $!\n";
while(<FILE>){
my @array = split(/:/,$_);
my $gid=(stat($array[5]))[5];
if ($array[5] eq /^\s*$/){
print "User $array[0]" . " has no home directory\n";
}
if (-o $array[5] ){
print "The directory $array[5] is not owned by $array[0]\n";
}
if ($array[3] ne $gid){
print "The directory $array[5] belongs to the incorrect group\n";
}
if (-g $array[5] ){
print "The directory $array[5] has the gid bit set\n";
}
}
close(FILE);
I need to convert the following Perl script into a shell script. Any help is appreciated.
#!/usr/bin/perl
use strict;
my $File = "/etc/passwd";
open (FILE,"$File" || die "error: can't open $File: $!\n";
while(<FILE>){
my @array = split(/:/,$_);
my $gid=(stat($array[5]))[5];
if ($array[5] eq /^\s*$/){
print "User $array[0]" . " has no home directory\n";
}
if (-o $array[5] ){
print "The directory $array[5] is not owned by $array[0]\n";
}
if ($array[3] ne $gid){
print "The directory $array[5] belongs to the incorrect group\n";
}
if (-g $array[5] ){
print "The directory $array[5] has the gid bit set\n";
}
}
close(FILE);