The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Can't create users in /home sdspawankumar SUN Solaris 4 08-21-2008 12:13 PM
How to create users on HP UX???? mascotlee UNIX Desktop for Dummies Questions & Answers 8 07-21-2008 03:02 AM
create users from template rijeshpp Shell Programming and Scripting 0 10-31-2007 10:29 AM
script to create users on many servers dnidiffer Shell Programming and Scripting 1 09-25-2005 03:32 AM
shell scripts to create 100 users xiamin UNIX for Dummies Questions & Answers 9 09-07-2001 02:47 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-25-2007
xeniya xeniya is offline
Registered User
  
 

Join Date: May 2007
Posts: 3
For loop to create 9000 users

Hello, I need to figure out how to create a shell
script that iterates 9000 times to create users.

so far i have this:

#!/bin/sh
#Script adds multiple users into the Service manager

i=0

for i in 1 * 9000
do
./insuser /WideSpan/config/vipclient.conf $i $i password 0 Org1 UserGroup1 'A' 1 "" "" root
done

Am I on the right track ?
  #2 (permalink)  
Old 05-25-2007
aigles's Avatar
aigles aigles is offline Forum Advisor  
Registered User
  
 

Join Date: Apr 2004
Location: Bordeaux, France
Posts: 1,428
You can do something like that:
Code:
#!/bin/sh
#Script adds multiple users into the Service manager

i=1
while [ $i -le 9000 ]
do
   ./insuser /WideSpan/config/vipclient.conf $i $i password 0 Org1 UserGroup1 'A' 1 "" "" root
   i=`expr $i + 1`
done

Jean-Pierre.
  #3 (permalink)  
Old 05-25-2007
cfajohnson's Avatar
cfajohnson cfajohnson is offline Forum Advisor  
Shell programmer, author
  
 

Join Date: Mar 2007
Location: Toronto, Canada
Posts: 2,361
Quote:
Originally Posted by aigles
You can do something like that:
Code:
#!/bin/sh
#Script adds multiple users into the Service manager

i=1
while [ $i -le 9000 ]
do
   ./insuser /WideSpan/config/vipclient.conf $i $i password 0 Org1 UserGroup1 'A' 1 "" "" root
   i=`expr $i + 1`
done

Except that, instead of calling an external command 9,000 times, use the shell to do the arithmetic:

Code:
i=$(( $i + 1 ))
All *nix systems within the last 15 years have shells that perform integer arithmetic.

Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 01:13 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0