源码文件:add.sh
-
#!/bin/sh
-
groupadd users
-
T_class=$1
-
num_class=`expr $2 + 0`
-
if (test $num_class -le 9)
-
then
-
num_class=$num_class
-
fi
-
max_stid=`expr $3`
-
num_userid=1
-
if [ ! -x /home/$1$num_class ]
-
then
-
mkdir /home/$1$num_class
-
fi
-
while (test $num_userid -le $max_stid)
-
do
-
if (test $num_userid -le 9)
-
then
-
num_userid="0"$num_userid
-
else
-
num_userid=$num_userid
-
fi
-
user_name=$T_class$num_class$num_userid
-
-
echo $user_name":"$user_name >> user_pwlist
-
adduser -g users -d /home/$1$num_class/$user_name $user_name
-
chmod 775 /home/$1$num_class/$user_name
-
num_userid=`expr $num_userid + 1`
-
done
-
chpasswd < user_pwlist
-
pwconv
-
rm user_pwlist -f
执行方法:./add.sh 110410 120 50
生成的效果就是:11041012001........11041012050
阅读(1543) | 评论(0) | 转发(1) |