- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- create 250 user ids in a go
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2004 05:59 PM
02-16-2004 05:59 PM
Do any of u genius out there have any script that can create 250 user id at a go.
I need to create them in a trusted system.
The ids should be like aba001, aba002 .....aba250
Thanks
Regards
Joyce
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2004 06:15 PM
02-16-2004 06:15 PM
SolutionCreate a text file name "users"
aba001
aba002
aba003
...
aba250
Following piece of code will do:
for i in `cat users`
do
useradd $i
done
you may need to add any options to useradd command like Shell, Home directory etc.
Vijay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2004 06:45 PM
02-16-2004 06:45 PM
Re: create 250 user ids in a go
As vijay said.
create a text file, with all uid's
#for i in 'cat
do
useradd -g
done
will create all id's in a go.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2004 07:10 PM
02-16-2004 07:10 PM
Re: create 250 user ids in a go
while [ "$x" -le 9 ]; do
echo "user aba00$x created"
useradd aba00$x
# increment x by 1
x=$(expr $x + 1)
done
Then do this for the ranges 010 to 099
(aba0$x)
and from 100 to 250
(aba$x)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2004 07:19 PM
02-16-2004 07:19 PM
Re: create 250 user ids in a go
useradd -g
HTH,
Peter Geluk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2004 07:31 PM
02-16-2004 07:31 PM
Re: create 250 user ids in a go
For your information: using an appropiate shell, one can define a variable wirh leading zeroes, e.g.
typeset -Z3 userno
If you say: userno=$x, userno will become 001, 002, ...., 250.
This makes your script easier.
JP.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2004 07:33 PM
02-16-2004 07:33 PM
Re: create 250 user ids in a go
Being almost geriatric, I'll have to write that one in my book....
Pity I can't assign you points.
Joyce, give him a couple, will you?