LinuxQuestions.org
Visit Jeremy's Blog.
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-15-2013, 05:58 PM   #1
linuxmantra
Member
 
Registered: Dec 2013
Posts: 113

Rep: Reputation: Disabled
Creating multiple groups


Suppose there are groups called
DBA
Redhat
Solaris
Marketing

We know to create group, command is
# groupadd <group_name>
by this we will be able to create one group at a time. Is there any command by which we can create all groups at a time..??
 
Old 12-15-2013, 06:08 PM   #2
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by linuxmantra View Post
Suppose there are groups called
DBA
Redhat
Solaris
Marketing

We know to create group, command is
# groupadd <group_name>
by this we will be able to create one group at a time. Is there any command by which we can create all groups at a time..??
for g in DBA Redhat Solaris Marketing; do groupadd $g; done
 
Old 12-15-2013, 06:09 PM   #3
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
How about something simple:
Code:
for i in group1 group2 group3 do groupadd $i; done
 
Old 12-15-2013, 07:53 PM   #4
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by jpollard View Post
How about something simple:
Code:
for i in group1 group2 group3 do groupadd $i; done
True but I won anyway. By the way you forgot a semicolon.

Last edited by berndbausch; 12-15-2013 at 07:55 PM. Reason: Typo and opportunity to add a negative remark
 
  


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
creating volume groups cbtshare Linux - Newbie 5 03-21-2013 12:30 AM
creating groups with asterisk Tarikc Linux - Server 3 01-13-2013 04:52 PM
creating users and groups gurl4sh25 SUSE / openSUSE 3 08-05-2006 12:02 PM
Creating Groups... gfrair Linux - Newbie 2 01-31-2005 07:38 PM
creating groups spank Linux - Newbie 2 11-02-2003 02:54 AM

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

All times are GMT -5. The time now is 02:07 AM.

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