LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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: 111

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
Senior Member
 
Registered: Nov 2013
Location: Tokyo
Distribution: Redhat/Centos, Ubuntu, Raspbian, Fedora
Posts: 1,691

Rep: Reputation: 353Reputation: 353Reputation: 353Reputation: 353
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,688

Rep: Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259
How about something simple:
Code:
for i in group1 group2 group3 do groupadd $i; done
 
Old 12-15-2013, 07:53 PM   #4
berndbausch
Senior Member
 
Registered: Nov 2013
Location: Tokyo
Distribution: Redhat/Centos, Ubuntu, Raspbian, Fedora
Posts: 1,691

Rep: Reputation: 353Reputation: 353Reputation: 353Reputation: 353
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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


All times are GMT -5. The time now is 08:01 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration