PDA

View Full Version : a script for creating multiple users



cukerko
6th March 2008, 02:51 PM
hi.. i wanna write a script which would add multiple users. i wanna use a for loop like "for i in ....; do useradd" where .... is a sequence from 1 to 1000. sure i don't wanna type those numbers manually, so i wanna use command seq 1 1 1000. how can i implement the seq command into the script? thanx

leadgolem
6th March 2008, 03:17 PM
Usually you can get faster answers to these kind of questions in the freenode irc channel #bash.

BostonWatcher
6th March 2008, 03:41 PM
Use bash's command expansion with $(your command here command). In this case $(seq 1 1000):


for i in $(seq 1 1000) ; do echo Here is $i ; done