#!/bin/bash
name="user"
for number in $(seq 1 20)
do
password=$(cat /dev/urandom | head -1 | md5sum| head -c 5)
useradd $name$number
echo "$password" | passwd --stdin $name$number >& /dev/null
echo "$name$number $password" >> userinfo.txt
done
转载于:https://blog.51cto.com/innocence/2106760