I'm trying to write a script that when called with 3 parameters as followed a letter,lower number id,max id will create generic user accounts.All acounts need to have passwords set to st3T63
example call /home/john/acctgenerator s 120 140
would use s as the startig letter and create accounts s120,s121,.....s140
I'm thinking to try using useradd in the script however everything would go smoothly except how to set the password for each account. I'm not sure if this would be possible experts would i be better off opening up /etc/passwd doing everything manually?
this is what i'm thinking the script will look like in it's infancy.............
while [ $1 > $2 ] <=== i think this grabs the first two parameters of the call...however are they strings i need 120 to 140 to int's here because thats how many accounts i'll need
echo useradd -u $0+$1 -c$0 -g11 -s/bin/ksh "$0+$1"
echo passwd st3T63
$1 = `expr $1 + 1` <== increment 120 to 121,.140
hows this logic look ?
any tips and hits would be appreciated