LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-03-2011, 04:38 PM   #1
ochieman2000
LQ Newbie
 
Registered: Oct 2011
Posts: 15

Rep: Reputation: Disabled
Perl and using commands within it


Hey all,

I have a perl script I am creating. Simple enough, just adds a user and assigned group and permissions.

I keep getting an error when using the -G in adduser

this is my code so far. Also any ideas on how to end the program when done. I was playing with some until conditionals and if else but nothing that I have mastered.

Thanks

Code:
#!/usr/bin/perl
#user add script

print "Welcome to AddUser Script\n\n";
print "To end this program, please enter end as the username\n\n";
print "User Name:";
$userinput =  <STDIN>;
chomp ($userinput);
useradd -G emails $userinput;
 
Old 12-03-2011, 06:31 PM   #2
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Quote:
I keep getting an error when using the -G in adduser
Well what kind of error are you getting? Just saying "an error" could mean many things. Also, are you running that as root?
 
Old 12-03-2011, 06:52 PM   #3
ochieman2000
LQ Newbie
 
Registered: Oct 2011
Posts: 15

Original Poster
Rep: Reputation: Disabled
Can't locate object method "G" via package "emails" (perhaps you forgot to load "emails"?) at adduser.perl line 9, <STDIN> line 1.
 
Old 12-03-2011, 06:53 PM   #4
Chirel
Member
 
Registered: Nov 2009
Posts: 55

Rep: Reputation: 19
Hi,

replace

Quote:
useradd -G emails $userinput;
by

Quote:
system("useradd -G emails $userinput");
good luck to finish this work.
 
1 members found this post helpful.
Old 12-03-2011, 08:43 PM   #5
ochieman2000
LQ Newbie
 
Registered: Oct 2011
Posts: 15

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Chirel View Post
Hi,

replace



by



good luck to finish this work.
Wonderful help, Thank you
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Write iptables commands in perl ? mortez Programming 4 07-15-2010 04:58 AM
Perl redirecting shell commands ifeatu Programming 3 12-10-2009 11:07 PM
run Telnet via Perl Commands? lotonewtork Programming 1 01-18-2007 05:36 AM
perl and linux commands Ammad Programming 3 02-11-2006 01:38 PM
vim commands in perl JohanLingen Programming 5 01-08-2003 04:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration