Hey List,
Just a quick question. I have the following code below...
sub ADD_SHADOW {
my $passwdFILE = '/etc/passwd';
my $shadow = '/etc/shadow';
open FILE, "$passwdFILE" or die "Cannot open $passwdFILE in READ
ONLY mode:$!";
open SHADOW, ">>$shadow" or die "Cannot open $shadow in APPENDING
mode:$!";
my @lines = <FILE>;
@lines = map { add_star( $_ ) }
map { [split /:/] } @lines;
seek SHADOW, 0, 0;
print SHADOW @lines;
truncate( SHADOW, tell(SHADOW) );
close FILE;
close SHADOW;
sub add_star {
my $array_ref = shift;
if ( $array_ref->[3] == 45 && $array_ref->[0] =~ /^$new_user/ ) {
print $array_ref;
}
return join ':', @$array_ref;
}
}
Now what I want to do is only append $array_ref to /etc/shadow I do not
want to append all of /etc/passwd to /etc/shadow. My problem is that I
am doing just that and I can't just append the elemnt of the array
($array_ref) to /etc/passwd
Is there a simplefix to this one?
Regards,
Dan
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]