#!/bin/bash
echo "how much users do you want to create:"
read num
i=0
while true
do
let i=i+1
echo "user"$i":passwd"$i >/root/user.txt
echo "create user$i....................."
useradd user$i
if [ $i -eq $num ]
then
chpasswd </root/user.txt
rm -f /root/user.txt
echo "completed! bye!"
exit
fi
done
http://www.leadkj.com/archives-276.html