Thank to the lovely monks help I have been working out my coding project for the week. However I have run into an issue regarding groups. I have been using the following code to add a group. It seems the group is not being added even though I get no errors when running the code. After I add a group I've been leaving the script and checking to see if group has been added in the terminal using the cat /etc/group command. I don't see it added. Any ideas why? I apologize for any mistakes word might have put in I can't seem to copy and paste from the shell. I am using oracle vm with Ubuntu and perl version 5.18.2 I am also using warning and strict and have no errors coming up.
3 => sub{ # do groupadd my $groupName = get_group (“Please enter new group name: “); if (getgrnam($groupName)) { print “Group already exists.”; } else { #if group does not exist create group ## FIXME delete “echo” system (“echo” , “groupadd”, “$groupName”); print “$groupName has been added. \n”; } }, sub get_group{ my $group = shift; print $group; chomp (my $ngroup = <>); return $nGroup; }
As I have to call for groups several times during the program I created a subroutine for it.
In reply to adding a group to the Unix System by deyaneria
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |