A
al dav
Hi all.
It has been bothering me how messy the following code is. I want to be able
to look for an entry in a file and do something if it is not there.
Is there a neater way of doing this ?
------------------------------------------------------
open("GROUP", "/etc/group");
@GROUP=<GROUP>;
while($g=shift @GROUP){
if ($g=~/^wheel/){
$foundgrp=1;
print "group present\n";
}
}
if (not defined $foundgrp){
system "/sbin/groupadd wheel"
}
It has been bothering me how messy the following code is. I want to be able
to look for an entry in a file and do something if it is not there.
Is there a neater way of doing this ?
------------------------------------------------------
open("GROUP", "/etc/group");
@GROUP=<GROUP>;
while($g=shift @GROUP){
if ($g=~/^wheel/){
$foundgrp=1;
print "group present\n";
}
}
if (not defined $foundgrp){
system "/sbin/groupadd wheel"
}