-
-
Save jciechowski/1590462 to your computer and use it in GitHub Desktop.
W pliku /etc/group pierwszy element wiersza to nazwa grupy. W pliku /etc/passwd pierwszy element to login. Znajdź wszystkie loginy, które nie mają identycznie nazwanej grupy.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/perl -w | |
use strict; | |
my @group = (); | |
my @passwd = (); | |
my %A; | |
open(GROUP,'</etc/group') or die "Nie mozna otworzyc group!:$!"; | |
while(<GROUP>) { | |
chomp; | |
@group = split(':',$_); | |
$A{$group[0]}=$group[0]; | |
} | |
close(GROUP); | |
open(PASSWD,'</etc/passwd') or die "Nie mozna otworzyc passwd!:$!"; | |
while(<PASSWD>) { | |
chomp; | |
@passwd = split(':',$_); | |
print "$passwd[0]\n" if !exists $A{$passwd[0]}; | |
} | |
close(PASSWD); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment