Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
I'm able to create a group but when I'm trying to delete the group it keeps stating Group Doesn't Exist. I know the group exist since I created it and look at the etc/group file which is there but for some odd reason I'm unable to delete it???
2. Relevant commands, code, scripts, algorithms: 3. The attempts at a solution (include all code and scripts):
Tried to get some advice from stack exchange guys but no luck. I tried changing variables but that didn't help.
4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
CTU Online, N Chestnut St, Colorado Springs, CO 80907, Instructor Tarik Illes Course CS345
Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).
groupdel (On Linux and some other UNIXES ) does not have a -g option. Your code is incurring an error and failing; note you are interpreting it as the 'group does not exist'.
Commands can fail dozens of ways. Read the info or man page for the allowed options for your flavor of UNIX. And trap all of the errors you can so your code is not misleading, simply say something like 'groupdel failed.' To do this you need to redirect stderr in your code to a variable or to stdout. In other words, display the error message groudel or goupadd emits.
Hi dude,
the actual problem is the wrong "if"-statement, one line before the "groupdel" command.
Due to the exclamation mark, it reads like "If the group ... is NOT found, delete it",
but since the group does exist, the else part of that if statement gets triggered.
So you got to remove the exclamation mark (!) in the line 53.
I guess that happened because you copied it from the groupadd section.
Here are some further suggestions:
1. imho you don't need to read from STDIN at the program start, so try this instead:
2. There is a "-g" option missing between the groupadd command and $group_id
3. groupdel requires groupname as argument, so probably you should remove -g $group_id (see jim's answer)
4. you should not simply system("some-command") and then independently print some status or return code. Try this:
5. if ($choice == 1) ... elsif ($choice == 2) ... if ($choice == 3) seems not to be consistent
6. If your perl script still misbehaves, consider using the perl debugger: perl -d yourscript.pl
HTH, good luck!
This User Gave Thanks to junior-helper For This Post:
Need to use dd to generate a large file from a sample file of random data. This is because I don't have /dev/urandom.
I create a named pipe then:
dd if=mynamed.fifo do=myfile.fifo bs=1024 count=1024
but when I cat a file to the fifo that's 1024 random bytes:
cat randomfile.txt >... (7 Replies)
Our SAN administrator decided to unpresent then destroy LUN's we were actively using as a volume group (all PV's in said volume group). Now every time I do a pvscan or whatever it complains about I/O errors trying to access those PV's. How do I get it to forget the VG existed completely? vgreduce... (7 Replies)
Hii all,
i create the user
useradd -d /home/kk kk
passwd kk
when i tried to login to kk
i get a error user directory doesn't exist
then i tried
useradd kkk
passwd kkkwhen i tried to login to kkk
i get the same error user directory doesn't exist. (4 Replies)
Hi there, normally if I want to remove a user tht I have added to a specific group, i would do the following
this is what my group2 looks like
# grep group2 /etc/group
group2:x:7777:user2,user1,user4
user1 has been defined in a few groups
# id -nG user1
group1 group2 group3
So... (3 Replies)
Hey,
I'm currently getting into some kernel module progamming. As a little exercise I want to read the headers out of an ELF file. My code is very simple, here is the important part:
struct file *fp;
/* ... */
fp = filp_open("some/file/on/my/pc", O_RDONLY, 0);
if(fp == NULL) {
... (15 Replies)
Hello,
I want to run one (not multiple) action if an element doesn't exist in array.
for example:
@array = (1..10);
foreach $el (@array)
{
if ($el != 11)
{
print "number not found\n";
}
}
the output of this simple script:
number not found (3 Replies)
Hey People,
I've got a question! How can i write a function in a script which is looking for if a group exist and if not, that the group "users" is the standard group..I know that i have to use "grep" und "if-else"..I will be very happy for answers ;)
Greetz
Ali (2 Replies)
I have a script that is working:
#!/bin/bash
sftp user@domain.com <<EOF
cd somedir
mget *.csv
quit
EOF
but on a crontab I want to only pull newer files, so I want to do something like:
while read ls current dir local file != true do
mget that new file
but I'm not sure the syntax... (2 Replies)
I'm kinda new to unix programming so bear with me...
I'm running a script prompting a user for an existing user and group and want to be able to validate if they valid.
Is there any code available?
Any help or push in the right direction would help.
Thank you, (2 Replies)
As part of a NIS implementation, (I think) I want to create a group (in /etc/group) that has users that do not exist on the target machine.
What effect will this have? Will it cause any problems?
Thanks,
Gary Cooper (1 Reply)