I am having trouble with a portion of my custom add user script. I want to
display the contents of /etc/groups (gid 500-531) numbered. I then want to
input the number(s) of the groups I want to add the user to (input should be
in csv). The catch is I don't want just any number to work - I want the user
to be able to enter only the index # and a comma to delimit the entries.
This is so I can move the script to Curses and perlmenu later.
Any suggestions? (The code follows.)
***************************************************
#!/usr/bin/perl
use Term::ReadKey;
#sub GRPS {
open (GROUP, "/etc/group");
while(<GROUP>) {
chomp;
@gid=split(/:/, $_);
if ( $gid[2] > 499 && $gid[2] < 532 ) {
push (@supgrp, "$gid[2],$gid[0]");
}
}
printf "Listing available groups...\n\n";
#do something @supgrp foreach $i (@supgrp) { ($gid,$name) = split(/,/,
$i); }
printf "Default user group is $username.\n";
printf "Please enter any supplemental gid's (comma separated values).\n";
$sgid = ReadLine 0;
chomp $sgid;
printf "\n\n";
#}
printf "Supplemental groups are: $sgid.";
*************************************************************
Thanks for any insight or help.
Foxhunt
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]